[Scummvm-cvs-logs] SF.net SVN: scummvm:[38190] scummvm/trunk

athrxx at users.sourceforge.net athrxx at users.sourceforge.net
Sun Feb 15 04:36:30 CET 2009


Revision: 38190
          http://scummvm.svn.sourceforge.net/scummvm/?rev=38190&view=rev
Author:   athrxx
Date:     2009-02-15 03:36:30 +0000 (Sun, 15 Feb 2009)

Log Message:
-----------
LOL: - implemented proper button processing (works exactly as in Kyra 2 and 3, so we do have some code duplication atm, I just fixed right mouse button support for LOL)
- keyboard control now works

Modified Paths:
--------------
    scummvm/trunk/dists/engine-data/kyra.dat
    scummvm/trunk/engines/kyra/gui.cpp
    scummvm/trunk/engines/kyra/gui.h
    scummvm/trunk/engines/kyra/gui_lok.h
    scummvm/trunk/engines/kyra/gui_lol.cpp
    scummvm/trunk/engines/kyra/gui_lol.h
    scummvm/trunk/engines/kyra/gui_v2.cpp
    scummvm/trunk/engines/kyra/gui_v2.h
    scummvm/trunk/engines/kyra/kyra_v1.cpp
    scummvm/trunk/engines/kyra/lol.cpp
    scummvm/trunk/engines/kyra/lol.h
    scummvm/trunk/engines/kyra/script_tim.cpp
    scummvm/trunk/engines/kyra/staticres.cpp
    scummvm/trunk/tools/create_kyradat/create_kyradat.cpp

Modified: scummvm/trunk/dists/engine-data/kyra.dat
===================================================================
(Binary files differ)

Modified: scummvm/trunk/engines/kyra/gui.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui.cpp	2009-02-15 01:56:02 UTC (rev 38189)
+++ scummvm/trunk/engines/kyra/gui.cpp	2009-02-15 03:36:30 UTC (rev 38190)
@@ -114,8 +114,8 @@
 			menuButtonData->width  = menu.item[i].width - 1;
 			menuButtonData->height = menu.item[i].height - 1;
 			menuButtonData->buttonCallback = menu.item[i].callback;
-			menuButtonData->unk6 = menu.item[i].unk1F;
-			menuButtonData->unk8 = 0;
+			menuButtonData->keyCode = menu.item[i].unk1F;
+			menuButtonData->keyCode2 = 0;
 
 			_menuButtonList = addButtonToList(_menuButtonList, menuButtonData);
 		}

Modified: scummvm/trunk/engines/kyra/gui.h
===================================================================
--- scummvm/trunk/engines/kyra/gui.h	2009-02-15 01:56:02 UTC (rev 38189)
+++ scummvm/trunk/engines/kyra/gui.h	2009-02-15 03:36:30 UTC (rev 38190)
@@ -46,8 +46,8 @@
 	Button *nextButton;
 	uint16 index;
 
-	uint16 unk6;
-	uint16 unk8;
+	uint16 keyCode;
+	uint16 keyCode2;
 
 	byte data0Val1;
 	byte data1Val1;

Modified: scummvm/trunk/engines/kyra/gui_lok.h
===================================================================
--- scummvm/trunk/engines/kyra/gui_lok.h	2009-02-15 01:56:02 UTC (rev 38189)
+++ scummvm/trunk/engines/kyra/gui_lok.h	2009-02-15 03:36:30 UTC (rev 38190)
@@ -34,7 +34,7 @@
 	do { \
 		button.nextButton = 0; \
 		button.index = a; \
-		button.unk6 = button.unk8 = 0; \
+		button.keyCode = button.keyCode2 = 0; \
 		button.data0Val1 = b; \
 		button.data1Val1 = c; \
 		button.data2Val1 = d; \

Modified: scummvm/trunk/engines/kyra/gui_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui_lol.cpp	2009-02-15 01:56:02 UTC (rev 38189)
+++ scummvm/trunk/engines/kyra/gui_lol.cpp	2009-02-15 03:36:30 UTC (rev 38190)
@@ -613,8 +613,8 @@
 	b->data2Val3 = 0x01;
 
 	b->index = cnt;
-	b->unk6 = _buttonData[index].clickedShapeId;
-	b->unk8 = _buttonData[index].unk2;
+	b->keyCode = _buttonData[index].keyCode;
+	b->keyCode2 = _buttonData[index].keyCode2;
 	b->dimTableIndex = _buttonData[index].screenDim;
 	b->flags = _buttonData[index].buttonflags;
 
@@ -722,6 +722,18 @@
 }
 
 int LoLEngine::clickedMagicButton(Button *button) {
+	if (_characters[button->data2Val2].flags & 0x314C)
+		return 1;
+
+	if (notEnoughMagic(button->data2Val2, _availableSpells[_selectedSpell], 0))
+		return 1;
+
+	_characters[button->data2Val2].flags ^= 0x10;
+
+	gui_drawCharPortraitWithStats(button->data2Val2);
+	spellsub2(button->data2Val2);
+	_unkCharNum = button->data2Val2;
+
 	return 1;
 }
 
@@ -842,90 +854,334 @@
 GUI_LoL::GUI_LoL(LoLEngine *vm) : GUI(vm), _vm(vm), _screen(vm->_screen) {
 	_scrollUpFunctor = BUTTON_FUNCTOR(GUI_LoL, this, &GUI_LoL::scrollUp);
 	_scrollDownFunctor = BUTTON_FUNCTOR(GUI_LoL, this, &GUI_LoL::scrollDown);
+	_unknownButtonList = _backUpButtonList = 0;
+	_flagsModifier = 0;
+	_buttonListChanged = false;
 }
 
-int GUI_LoL::processButtonList(Button *list, uint16 inputFlag, int8 mouseWheel) {
-	inputFlag &= 0x7fff;
+void GUI_LoL::processButton(Button *button) {
+	if (!button)
+		return;
 
-	int returnValue = 0;
-	while (list) {
-		bool processMouseClick = (inputFlag == 199 && list->flags & 0x100) || (inputFlag == 299 && list->flags & 0x1000);
-		bool target = _vm->posWithinRect(_vm->_mouseX, _vm->_mouseY, list->x, list->y, list->x + list->width, list->y + list->height);
+	if (button->flags & 8) {
+		if (button->flags & 0x10) {
+			// XXX
+		}
+		return;
+	}
 
-		/*if (list->flags & 8) {
-			list = list->nextButton;
-			continue;
+	int entry = button->flags2 & 5;
+
+	byte val1 = 0, val2 = 0, val3 = 0;
+	const uint8 *dataPtr = 0;
+	Button::Callback callback;
+	if (entry == 1) {
+		val1 = button->data1Val1;
+		dataPtr = button->data1ShapePtr;
+		callback = button->data1Callback;
+		val2 = button->data1Val2;
+		val3 = button->data1Val3;
+	} else if (entry == 4 || entry == 5) {
+		val1 = button->data2Val1;
+		dataPtr = button->data2ShapePtr;
+		callback = button->data2Callback;
+		val2 = button->data2Val2;
+		val3 = button->data2Val3;
+	} else {
+		val1 = button->data0Val1;
+		dataPtr = button->data0ShapePtr;
+		callback = button->data0Callback;
+		val2 = button->data0Val2;
+		val3 = button->data0Val3;
+	}
+
+	int x = 0, y = 0, x2 = 0, y2 = 0;
+
+	x = button->x;
+	if (x < 0)
+		x += _screen->getScreenDim(button->dimTableIndex)->w << 3;
+	x += _screen->getScreenDim(button->dimTableIndex)->sx << 3;
+	x2 = x + button->width - 1;
+
+	y = button->y;
+	if (y < 0)
+		y += _screen->getScreenDim(button->dimTableIndex)->h << 3;
+	y += _screen->getScreenDim(button->dimTableIndex)->sy << 3;
+	y2 = y + button->height - 1;
+
+	switch (val1 - 1) {
+	case 0:
+		_screen->hideMouse();
+		_screen->drawShape(_screen->_curPage, dataPtr, x, y, button->dimTableIndex, 0x10);
+		_screen->showMouse();
+		break;
+
+	case 1:
+		_screen->hideMouse();
+		_screen->printText((const char*)dataPtr, x, y, val2, val3);
+		_screen->showMouse();
+		break;
+
+	case 3:
+		if (callback)
+			(*callback)(button);
+		break;
+
+	case 4:
+		_screen->hideMouse();
+		_screen->drawBox(x, y, x2, y2, val2);
+		_screen->showMouse();
+		break;
+
+	case 5:
+		_screen->hideMouse();
+		_screen->fillRect(x, y, x2, y2, val2, -1, true);
+		_screen->showMouse();
+		break;
+
+	default:
+		break;
+	}
+
+	_screen->updateScreen();
+}
+
+int GUI_LoL::processButtonList(Button *buttonList, uint16 inputFlag, int8 mouseWheel) {
+	if (!buttonList)
+		return inputFlag & 0x7FFF;
+
+	if (_backUpButtonList != buttonList || _buttonListChanged) {
+		_unknownButtonList = 0;
+		//flagsModifier |= 0x2200;
+		_backUpButtonList = buttonList;
+		_buttonListChanged = false;
+
+		while (buttonList) {
+			processButton(buttonList);
+			buttonList = buttonList->nextButton;
 		}
+	}
 
-		if (mouseWheel && list->mouseWheel == mouseWheel && list->buttonCallback) {
-			if ((*list->buttonCallback.get())(list))
-				break;
+	int mouseX = _vm->_mouseX;
+	int mouseY = _vm->_mouseY;
+
+	uint16 flags = 0;
+
+	if (1/*!_screen_cursorDisable*/) {
+		uint16 inFlags = inputFlag & 0xFF;
+		uint16 temp = 0;
+
+		// HACK: inFlags == 200 is our left button (up)
+		if (inFlags == 199 || inFlags == 200)
+			temp = 0x100;
+		if (inFlags == 201 || inFlags == 202)
+			temp = 0x1000;
+
+		if (inputFlag & 0x800)
+			temp <<= 2;
+
+		flags |= temp;
+
+		_flagsModifier &= ~((temp & 0x4400) >> 1);
+		_flagsModifier |= (temp & 0x1100) * 2;
+		flags |= _flagsModifier;
+		flags |= (_flagsModifier << 2) ^ 0x8800;
+	}
+
+	buttonList = _backUpButtonList;
+	if (_unknownButtonList) {
+		buttonList = _unknownButtonList;
+		if (_unknownButtonList->flags & 8)
+			_unknownButtonList = 0;
+	}
+
+	int returnValue = 0;
+	while (buttonList) {
+		if (buttonList->flags & 8) {
+			buttonList = buttonList->nextButton;
+			continue;
 		}
+		buttonList->flags2 &= ~0x18;
+		buttonList->flags2 |= (buttonList->flags2 & 3) << 3;
 
-		int x = list->x;
-		int y = list->y;
-		assert(_screen->getScreenDim(list->dimTableIndex) != 0);
-
+		int x = buttonList->x;
 		if (x < 0)
-			x += _screen->getScreenDim(list->dimTableIndex)->w << 3;
-		x += _screen->getScreenDim(list->dimTableIndex)->sx << 3;
+			x += _screen->getScreenDim(buttonList->dimTableIndex)->w << 3;
+		x += _screen->getScreenDim(buttonList->dimTableIndex)->sx << 3;
 
+		int y = buttonList->y;
 		if (y < 0)
-			y += _screen->getScreenDim(list->dimTableIndex)->h;
-		y += _screen->getScreenDim(list->dimTableIndex)->sy;
+			y += _screen->getScreenDim(buttonList->dimTableIndex)->h;
+		y += _screen->getScreenDim(buttonList->dimTableIndex)->sy;
 
-		if (_vm->_mouseX >= x && _vm->_mouseY >= y && x + list->width >= _vm->_mouseX && y + list->height >= _vm->_mouseY) {
-			int processMouseClick = 0;
-			if (list->flags & 0x400) {
-				if ((inputFlag & 0xFF) == 199 || _pressFlag) {
-					if (!(list->flags2 & 1)) {
-						list->flags2 |= 1;
-						list->flags2 |= 4;
-						processButton(list);
-						_screen->updateScreen();
-						inputFlag = 0;
+		bool progress = false;
+
+		if (mouseX >= x && mouseY >= y && mouseX <= x+buttonList->width && mouseY <= y+buttonList->height)
+			progress = true;
+
+		buttonList->flags2 &= ~0x80;
+		uint16 inFlags = inputFlag & 0x7FFF;
+		if (inFlags) {
+			if (buttonList->keyCode == inFlags) {
+				progress = true;
+				flags = buttonList->flags & 0x0F00;
+				buttonList->flags2 |= 0x80;
+				inputFlag = 0;
+				_unknownButtonList = buttonList;
+			} else if (buttonList->keyCode2 == inFlags) {
+				flags = buttonList->flags & 0xF000;
+				if (!flags)
+					flags = buttonList->flags & 0x0F00;
+				progress = true;
+				buttonList->flags2 |= 0x80;
+				inputFlag = 0;
+				_unknownButtonList = buttonList;
+			}
+		}
+
+		bool unk1 = false;
+
+		if (mouseWheel && buttonList->mouseWheel == mouseWheel) {
+			progress = true;
+			unk1 = true;
+		}
+
+		if (!progress)
+			buttonList->flags2 &= ~6;
+
+		if ((flags & 0x3300) && (buttonList->flags & 4) && progress && (buttonList == _unknownButtonList || !_unknownButtonList)) {
+			buttonList->flags |= 6;
+			if (!_unknownButtonList)
+				_unknownButtonList = buttonList;
+		} else if ((flags & 0x8800) && !(buttonList->flags & 4) && progress) {
+			buttonList->flags2 |= 6;
+		} else {
+			buttonList->flags2 &= ~6;
+		}
+
+		bool progressSwitch = false;
+		if (!_unknownButtonList) {
+			progressSwitch = progress;
+		} else  {
+			if (_unknownButtonList->flags & 0x40)
+				progressSwitch = (_unknownButtonList == buttonList);
+			else
+				progressSwitch = progress;
+		}
+
+		if (progressSwitch) {
+			if ((flags & 0x1100) && progress && !_unknownButtonList) {
+				inputFlag = 0;
+				_unknownButtonList = buttonList;
+			}
+
+			if ((buttonList->flags & flags) && (progress || !(buttonList->flags & 1))) {
+				uint16 combinedFlags = (buttonList->flags & flags);
+				combinedFlags = ((combinedFlags & 0xF000) >> 4) | (combinedFlags & 0x0F00);
+				combinedFlags >>= 8;
+
+				static const uint16 flagTable[] = {
+					0x000, 0x100, 0x200, 0x100, 0x400, 0x100, 0x400, 0x100, 0x800, 0x100,
+					0x200, 0x100, 0x400, 0x100, 0x400, 0x100
+				};
+
+				assert(combinedFlags < ARRAYSIZE(flagTable));
+
+				switch (flagTable[combinedFlags]) {
+				case 0x400:
+					if (!(buttonList->flags & 1) || ((buttonList->flags & 1) && _unknownButtonList == buttonList)) {
+						buttonList->flags2 ^= 1;
+						returnValue = buttonList->index | 0x8000;
+						unk1 = true;
 					}
-				} else if ((inputFlag & 0xFF) == 200) {
-					if (list->flags2 & 1) {
-						list->flags2 &= 0xFFFE;
-						processButton(list);
-						processMouseClick = 1;
-						inputFlag = 0;
+
+					if (!(buttonList->flags & 4)) {
+						buttonList->flags2 &= ~4;
+						buttonList->flags2 &= ~2;
 					}
+					break;
+
+				case 0x800:
+					if (!(buttonList->flags & 4)) {
+						buttonList->flags2 |= 4;
+						buttonList->flags2 |= 2;
+					}
+
+					if (!(buttonList->flags & 1))
+						unk1 = true;
+					break;
+
+				case 0x200:
+					if (buttonList->flags & 4) {
+						buttonList->flags2 |= 4;
+						buttonList->flags2 |= 2;
+					}
+
+					if (!(buttonList->flags & 1))
+						unk1 = true;
+					break;
+
+				case 0x100:
+				default:
+					buttonList->flags2 ^= 1;
+					returnValue = buttonList->index | 0x8000;
+					unk1 = true;
+					if (buttonList->flags & 4) {
+						buttonList->flags2 |= 4;
+						buttonList->flags2 |= 2;
+					}
+					_unknownButtonList = buttonList;
+					break;
 				}
 			}
+		}
 
-			if (processMouseClick) {
-				if (list->buttonCallback) {
-					if ((*list->buttonCallback.get())(list))
-						break;
-				}
+		bool unk2 = false;
+		if ((flags & 0x2200) && progress) {
+			buttonList->flags2 |= 6;
+			if (!(buttonList->flags & 4) && !(buttonList->flags2 & 1)) {
+				unk2 = true;
+				buttonList->flags2 |= 1;
 			}
-		} else {
-			if (list->flags2 & 1) {
-				list->flags2 &= 0xFFFE;
-				processButton(list);
-			}
+		}
 
-			if (list->flags2 & 4) {
-				list->flags2 &= 0xFFFB;
-				processButton(list);
-				_screen->updateScreen();
-			}
-		}*/
-		if (processMouseClick && target) {
-			if (list->buttonCallback) {
-				if ((*list->buttonCallback.get())(list))
+		if ((flags & 0x8800) == 0x8800) {
+			_unknownButtonList = 0;
+			if (!progress || (buttonList->flags & 4))
+				buttonList->flags2 &= ~6;
+		}
+
+		if (!progress && buttonList == _unknownButtonList && !(buttonList->flags & 0x40))
+			_unknownButtonList = 0;
+
+		if ((buttonList->flags2 & 0x18) != ((buttonList->flags2 & 3) << 3))
+			processButton(buttonList);
+
+		if (unk2)
+			buttonList->flags2 &= ~1;
+
+		if (unk1) {
+			buttonList->flags2 &= 0xFF;
+			buttonList->flags2 |= flags;
+
+			if (buttonList->buttonCallback) {
+				_vm->removeInputTop();
+				if ((*buttonList->buttonCallback.get())(buttonList))
 					break;
 			}
+
+			if (buttonList->flags & 0x20)
+				break;
 		}
 
-		list = list->nextButton;
+		if (_unknownButtonList == buttonList && (buttonList->flags & 0x40))
+			break;
+
+		buttonList = buttonList->nextButton;
 	}
 
 	if (!returnValue)
-		returnValue = inputFlag & 0xFF;
-
+		returnValue = inputFlag & 0x7FFF;
 	return returnValue;
 }
 

Modified: scummvm/trunk/engines/kyra/gui_lol.h
===================================================================
--- scummvm/trunk/engines/kyra/gui_lol.h	2009-02-15 01:56:02 UTC (rev 38189)
+++ scummvm/trunk/engines/kyra/gui_lol.h	2009-02-15 03:36:30 UTC (rev 38190)
@@ -41,7 +41,7 @@
 	void initStaticData();
 
 	// button specific
-	void processButton(Button *button) {}
+	void processButton(Button *button);
 	int processButtonList(Button *buttonList, uint16 inputFlags, int8 mouseWheel);
 
 	// utilities for thumbnail creation
@@ -53,6 +53,11 @@
 
 	bool _pressFlag;
 
+	Button *_unknownButtonList;
+	Button *_backUpButtonList;
+	bool _buttonListChanged;
+	uint16 _flagsModifier;
+
 	int scrollUp(Button *button) { return 0; }
 	int scrollDown(Button *button) { return 0; }
 

Modified: scummvm/trunk/engines/kyra/gui_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui_v2.cpp	2009-02-15 01:56:02 UTC (rev 38189)
+++ scummvm/trunk/engines/kyra/gui_v2.cpp	2009-02-15 03:36:30 UTC (rev 38190)
@@ -218,13 +218,13 @@
 		buttonList->flags2 &= ~0x80;
 		uint16 inFlags = inputFlag & 0x7FFF;
 		if (inFlags) {
-			if (buttonList->unk6 == inFlags) {
+			if (buttonList->keyCode == inFlags) {
 				progress = true;
 				flags = buttonList->flags & 0x0F00;
 				buttonList->flags2 |= 0x80;
 				inputFlag = 0;
 				_unknownButtonList = buttonList;
-			} else if (buttonList->unk8 == inFlags) {
+			} else if (buttonList->keyCode2 == inFlags) {
 				flags = buttonList->flags & 0xF000;
 				if (!flags)
 					flags = buttonList->flags & 0x0F00;

Modified: scummvm/trunk/engines/kyra/gui_v2.h
===================================================================
--- scummvm/trunk/engines/kyra/gui_v2.h	2009-02-15 01:56:02 UTC (rev 38189)
+++ scummvm/trunk/engines/kyra/gui_v2.h	2009-02-15 03:36:30 UTC (rev 38190)
@@ -34,8 +34,8 @@
 	do { \
 		button.nextButton = 0; \
 		button.index = a; \
-		button.unk6 = b; \
-		button.unk8 = c; \
+		button.keyCode = b; \
+		button.keyCode2 = c; \
 		button.data0Val1 = d; \
 		button.data1Val1 = e; \
 		button.data2Val1 = f; \

Modified: scummvm/trunk/engines/kyra/kyra_v1.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v1.cpp	2009-02-15 01:56:02 UTC (rev 38189)
+++ scummvm/trunk/engines/kyra/kyra_v1.cpp	2009-02-15 03:36:30 UTC (rev 38190)
@@ -260,23 +260,53 @@
 			} else {
 				switch(event.kbd.keycode) {
 					case Common::KEYCODE_SPACE:
-						keys = 100;
+						keys = 120;
 						break;
 					case Common::KEYCODE_RETURN:
-						keys = 101;
+						keys = 121;
 						break;
 					case Common::KEYCODE_UP:
-						keys = 110;
+					case Common::KEYCODE_KP8:
+						keys = 96;
 						break;
 					case Common::KEYCODE_RIGHT:
-						keys = 111;
+					case Common::KEYCODE_KP6:
+						keys = 102;
 						break;
 					case Common::KEYCODE_DOWN:
+					case Common::KEYCODE_KP2:
+						keys = 97;
+						break;
+					case Common::KEYCODE_LEFT:
+					case Common::KEYCODE_KP4:
+						keys = 92;
+						break;
+					case Common::KEYCODE_HOME:
+					case Common::KEYCODE_KP7:
+						keys = 91;
+						break;
+					case Common::KEYCODE_PAGEUP:
+					case Common::KEYCODE_KP9:
+						keys = 101;
+						break;
+					case Common::KEYCODE_F1:
 						keys = 112;
 						break;
-					case Common::KEYCODE_LEFT:
+					case Common::KEYCODE_F2:
 						keys = 113;
 						break;
+					case Common::KEYCODE_F3:
+						keys = 114;
+						break;
+					case Common::KEYCODE_o:
+						keys = 25;
+						break;
+					case Common::KEYCODE_r:
+						keys = 20;
+						break;
+					case Common::KEYCODE_ESCAPE:
+						keys = 110;
+						break;
 					default:
 						break;
 				}
@@ -303,7 +333,7 @@
 			Common::Point pos = getMousePos();
 			_mouseX = pos.x;
 			_mouseY = pos.y;
-			keys = (event.type == Common::EVENT_RBUTTONDOWN ? 299 : (300 | 0x800));
+			keys = (event.type == Common::EVENT_RBUTTONDOWN ? 201 : (202 | 0x800));
 			breakLoop = true;
 			} break;
 

Modified: scummvm/trunk/engines/kyra/lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/lol.cpp	2009-02-15 01:56:02 UTC (rev 38189)
+++ scummvm/trunk/engines/kyra/lol.cpp	2009-02-15 03:36:30 UTC (rev 38190)
@@ -1354,5 +1354,21 @@
 	y = ((block & 0xffe0) << 3) | yOffs;
 }
 
+bool LoLEngine::notEnoughMagic(int charNum, int spellNum, int spellLevel) {
+	if (_spellProperties[spellNum].mpRequired[spellLevel] > _characters[charNum].magicPointsCur) {
+
+		return true;
+	} else {
+		
+	}
+
+	return false;	
+}
+
+void LoLEngine::spellsub2(int charNum) {
+
+
+}
+
 } // end of namespace Kyra
 

Modified: scummvm/trunk/engines/kyra/lol.h
===================================================================
--- scummvm/trunk/engines/kyra/lol.h	2009-02-15 01:56:02 UTC (rev 38189)
+++ scummvm/trunk/engines/kyra/lol.h	2009-02-15 03:36:30 UTC (rev 38190)
@@ -209,8 +209,8 @@
 
 struct ButtonDef {
 	uint16 buttonflags;
-	uint8 clickedShapeId;
-	uint16 unk2;
+	uint16 keyCode;
+	uint16 keyCode2;
 	int16 x;
 	int16 y;
 	uint16 w;
@@ -848,6 +848,9 @@
 	void calcCoordinates(uint16 & x, uint16 & y, int block, uint16 xOffs, uint16 yOffs);
 
 	// spells
+	bool notEnoughMagic(int charNum, int spellNum, int spellLevel);
+	void spellsub2(int charNum);
+
 	int8 _availableSpells[7];
 	int _selectedSpell;
 	const SpellProperty *_spellProperties;

Modified: scummvm/trunk/engines/kyra/script_tim.cpp
===================================================================
--- scummvm/trunk/engines/kyra/script_tim.cpp	2009-02-15 01:56:02 UTC (rev 38189)
+++ scummvm/trunk/engines/kyra/script_tim.cpp	2009-02-15 03:36:30 UTC (rev 38190)
@@ -916,30 +916,30 @@
 			//}
 		}
 	} else {
-		int e = _vm->checkInput(0, false);
+		int e = _vm->checkInput(0, false) & 0xCF;
 		_vm->removeInputTop();
 		switch (e) {
-			case 100:
-			case 101:
+			case 120:
+			case 121:
 				_vm->snd_dialogueSpeechUpdate(1);
 				//_dlgTimer = 0;
 				res = _dialogueHighlightedButton + 1;
 				break;
 
-			case 110:
-			case 111:
+			case 92:
+			case 97:
 				if (_dialogueNumButtons > 1 && _dialogueHighlightedButton > 0)
 					_dialogueHighlightedButton--;
 				break;
 
-			case 112:
-			case 113:
+			case 96:
+			case 102:
 				if (_dialogueNumButtons > 1 && _dialogueHighlightedButton < (_dialogueNumButtons - 1))
 					_dialogueHighlightedButton++;
 				break;
 
 			case 200:
-			case 300:
+			case 202:
 				x = _dialogueButtonPosX;
 				
 				for (int i = 0; i < _dialogueNumButtons; i++) {

Modified: scummvm/trunk/engines/kyra/staticres.cpp
===================================================================
--- scummvm/trunk/engines/kyra/staticres.cpp	2009-02-15 01:56:02 UTC (rev 38189)
+++ scummvm/trunk/engines/kyra/staticres.cpp	2009-02-15 03:36:30 UTC (rev 38190)
@@ -44,7 +44,7 @@
 
 namespace Kyra {
 
-#define RESFILE_VERSION 36
+#define RESFILE_VERSION 37
 
 namespace {
 bool checkKyraDat(Common::SeekableReadStream *file) {
@@ -1078,9 +1078,8 @@
 
 	for (int i = 0; i < size; i++) {
 		r[i].buttonflags = file->readUint16BE();
-		r[i].clickedShapeId = file->readByte();
-		file->readByte();
-		r[i].unk2 = file->readUint16BE();
+		r[i].keyCode = file->readUint16BE();
+		r[i].keyCode2 = file->readUint16BE();
 		r[i].x = file->readSint16BE();
 		r[i].y = file->readSint16BE();
 		r[i].w = file->readUint16BE();

Modified: scummvm/trunk/tools/create_kyradat/create_kyradat.cpp
===================================================================
--- scummvm/trunk/tools/create_kyradat/create_kyradat.cpp	2009-02-15 01:56:02 UTC (rev 38189)
+++ scummvm/trunk/tools/create_kyradat/create_kyradat.cpp	2009-02-15 03:36:30 UTC (rev 38190)
@@ -31,7 +31,7 @@
 #include "md5.h"
 
 enum {
-	kKyraDatVersion = 36,
+	kKyraDatVersion = 37,
 	kIndexSize = 12
 };
 
@@ -1093,9 +1093,9 @@
 	for (int i = 0; i < num; i++) {
 		WRITE_BE_UINT16(dst, READ_LE_UINT16(src));
 		src += 2; dst += 2;
-		*dst++ = *src++;
-		*dst++ = *src++;
 		WRITE_BE_UINT16(dst, READ_LE_UINT16(src));
+		src += 2; dst += 2;
+		WRITE_BE_UINT16(dst, READ_LE_UINT16(src));
 		src += 6; dst += 2;
 		WRITE_BE_UINT16(dst, READ_LE_UINT16(src));
 		src += 2; dst += 2;


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