diff options
24 files changed, 402 insertions, 215 deletions
| diff --git a/devtools/create_mortdat/menudata.h b/devtools/create_mortdat/menudata.h index 6a5f8dcfad..ccdd13d7f2 100644 --- a/devtools/create_mortdat/menudata.h +++ b/devtools/create_mortdat/menudata.h @@ -77,17 +77,17 @@ const char *menuDataEn =  	"                        ";  const int verbsFr[26] = { 0x301, 0x302, 0x303, 0x304, 0x305, 0x306, 0x307, 0x308,  -                          0x309, 0x30a, 0x30b, 0x30c, 0x30d, 0x30e, 0x30f, 0x310, -                          0x311, 0x312, 0x313, 0x314, 0x315, 0x401, 0x402, 0x403, -                          0x404, 0x405 }; +						  0x309, 0x30a, 0x30b, 0x30c, 0x30d, 0x30e, 0x30f, 0x310, +						  0x311, 0x312, 0x313, 0x314, 0x315, 0x401, 0x402, 0x403, +						  0x404, 0x405 };  const int verbsEn[26] = { 0x301, 0x315, 0x305, 0x310, 0x309, 0x304, 0x302, 0x30f, -                          0x306, 0x30d, 0x30e, 0x303, 0x30c, 0x30b, 0x313, 0x30a, -                          0x311, 0x312, 0x307, 0x308, 0x314, 0x401, 0x405, 0x404, -                          0x403, 0x402 }; +						  0x306, 0x30d, 0x30e, 0x303, 0x30c, 0x30b, 0x313, 0x30a, +						  0x311, 0x312, 0x307, 0x308, 0x314, 0x401, 0x405, 0x404, +						  0x403, 0x402 }; -const int verbsDe[26] = { 0x30a, 0x310, 0x313, 0x301, 0x315, 0x308, 0x303, 0x306, -                          0x30c, 0x311, 0x314, 0x309, 0x30b, 0x30f, 0x30e, 0x304, -                          0x307, 0x30d, 0x312, 0x302, 0x305, 0x405, 0x402, 0x404, -                          0x403, 0x401 }; +const int verbsDe[26] = { 0x304, 0x314, 0x307, 0x310, 0x315, 0x308, 0x311, 0x306, +						  0x30c, 0x301, 0x30d, 0x309, 0x312, 0x30f, 0x30e, 0x302, +						  0x30a, 0x313, 0x303, 0x30b, 0x305, 0x405, 0x402, 0x404, +						  0x403, 0x401 };  #endif diff --git a/dists/engine-data/mort.dat b/dists/engine-data/mort.datBinary files differ index ae9579ee13..32074db139 100644 --- a/dists/engine-data/mort.dat +++ b/dists/engine-data/mort.dat diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index b8d197da2a..a7bd381603 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -57,13 +57,12 @@ int DialogManager::show(const Common::String &msg, int n) {  	decodeAlertDetails(msg, caseNumb, lignNumb, colNumb, alertStr, caseStr); -	int i = 0;  	Common::Point curPos;  	if (alertStr == "") {  		drawAlertBox(10, 5, colNumb);  	} else {  		drawAlertBox(8, 7, colNumb); -		i = 0; +		int i = 0;  		_vm->_screenSurface._textPos.y = 70;  		do {  			curPos.x = 320; @@ -229,13 +228,13 @@ void DialogManager::setPosition(int ji, int coldep, int esp) {   * Alert function - Draw Alert Box   * @remarks	Originally called 'fait_boite'   */ -void DialogManager::drawAlertBox(int lidep, int nli, int tx) { -	if (tx > 640) -		tx = 640; -	int x = 320 - ((uint)tx / 2); -	int y = (lidep - 1) * 8; -	int xx = x + tx; -	int yy = y + (nli * 8); +void DialogManager::drawAlertBox(int firstLine, int lineNum, int width) { +	if (width > 640) +		width = 640; +	int x = 320 - ((uint)width / 2); +	int y = (firstLine - 1) * 8; +	int xx = x + width; +	int yy = y + (lineNum * 8);  	_vm->_screenSurface.fillRect(15, Common::Rect(x, y, xx, yy));  	_vm->_screenSurface.fillRect(0, Common::Rect(x, y + 2, xx, y + 4));  	_vm->_screenSurface.fillRect(0, Common::Rect(x, yy - 4, xx, yy - 2)); diff --git a/engines/mortevielle/dialogs.h b/engines/mortevielle/dialogs.h index af667e40c5..ee210a62b2 100644 --- a/engines/mortevielle/dialogs.h +++ b/engines/mortevielle/dialogs.h @@ -48,7 +48,7 @@ private:  	void decodeAlertDetails(Common::String inputStr, int &choiceNumb, int &lineNumb, int &col, Common::String &choiceStr, Common::String &choiceListStr);  	void setPosition(int ji, int coldep, int esp); -	void drawAlertBox(int lidep, int nli, int tx); +	void drawAlertBox(int firstLine, int lineNum, int width);  	void setButtonText(Common::String c, int coldep, int nbcase, Common::String *str, int esp);  public:  	void setParent(MortevielleEngine *vm); diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 9e03e83127..1077f66fc2 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -155,30 +155,51 @@ void Menu::readVerbNums(Common::File &f, int dataSize) {   * Setup a menu's contents   * @remarks	Originally called 'menut'   */ -void Menu::setText(int menuId, int actionId, Common::String name) { +void Menu::setText(MenuItem item, Common::String name) {  	Common::String s = name; -	while (s.size() < 22) -		s += ' '; - -	switch (menuId) { +	switch (item._menuId) {  	case MENU_INVENTORY: -		if (actionId != 7) { -			_inventoryStringArray[actionId] = s; -			_inventoryStringArray[actionId].insertChar(' ', 0); +		if (item._actionId != 7) { +			while (s.size() < 22) +				s += ' '; + +			_inventoryStringArray[item._actionId] = s; +			_inventoryStringArray[item._actionId].insertChar(' ', 0);  		}  		break;  	case MENU_MOVE: -		_moveStringArray[actionId] = s; +		while (s.size() < 22) +			s += ' '; + +		_moveStringArray[item._actionId] = s;  		break; -	case MENU_ACTION: -		_actionStringArray[actionId] = s; +	case MENU_ACTION: { +		// If the first character isn't '*' or ' ' then it's missing a heading space +		char c = s[0]; +		if (c != '*' && c != ' ') +			s = ' ' + s; + +		while (s.size() < 10) +			s += ' '; + +		_actionStringArray[item._actionId] = s; +		}  		break; -	case MENU_SELF: -		_selfStringArray[actionId] = s; +	case MENU_SELF: { +		// If the first character isn't '*' or ' ' then it's missing a heading space +		char c = s[0]; +		if (c != '*' && c != ' ') +			s = ' ' + s; + +		while (s.size() < 10) +			s += ' '; + +		_selfStringArray[item._actionId] = s; +		}  		break;  	case MENU_DISCUSS: -		_discussStringArray[actionId] = s; +		_discussStringArray[item._actionId] = s;  		break;  	default:  		break; @@ -200,11 +221,11 @@ void Menu::setDestinationText(int roomId) {  		nomp = _vm->getString(_vm->_destinationArray[destinationId][roomId] + kMenuPlaceStringIndex);  		while (nomp.size() < 20)  			nomp += ' '; -		setText(_moveMenu[destinationId + 1]._menuId, _moveMenu[destinationId + 1]._actionId, nomp); +		setText(_moveMenu[destinationId + 1], nomp);  	}  	nomp = "*                   ";  	for (int i = 7; i >= destinationId + 1; --i) -		setText(_moveMenu[i]._menuId, _moveMenu[i]._actionId, nomp); +		setText(_moveMenu[i], nomp);  }  /** @@ -212,26 +233,26 @@ void Menu::setDestinationText(int roomId) {   * @param menuId	Menu number   * @param actionId  Item index   */ -void Menu::disableMenuItem(int menuId, int actionId) { -	switch (menuId) { +void Menu::disableMenuItem(MenuItem item) { +	switch (item._menuId) {  	case MENU_INVENTORY: -		if (actionId > 6) { -			_inventoryStringArray[actionId].setChar('<', 0); -			_inventoryStringArray[actionId].setChar('>', 21); +		if (item._actionId > 6) { +			_inventoryStringArray[item._actionId].setChar('<', 0); +			_inventoryStringArray[item._actionId].setChar('>', 21);  		} else -			_inventoryStringArray[actionId].setChar('*', 0); +			_inventoryStringArray[item._actionId].setChar('*', 0);  		break;  	case MENU_MOVE: -		_moveStringArray[actionId].setChar('*', 0); +		_moveStringArray[item._actionId].setChar('*', 0);  		break;  	case MENU_ACTION: -		_actionStringArray[actionId].setChar('*', 0); +		_actionStringArray[item._actionId].setChar('*', 0);  		break;  	case MENU_SELF: -		_selfStringArray[actionId].setChar('*', 0); +		_selfStringArray[item._actionId].setChar('*', 0);  		break;  	case MENU_DISCUSS: -		_discussStringArray[actionId].setChar('*', 0); +		_discussStringArray[item._actionId].setChar('*', 0);  		break;  	default:  		break; @@ -244,23 +265,23 @@ void Menu::disableMenuItem(int menuId, int actionId) {   * @param actionId  Item index   * @remarks	Originally called menu_enable   */ -void Menu::enableMenuItem(int menuId, int actionId) { -	switch (menuId) { +void Menu::enableMenuItem(MenuItem item) { +	switch (item._menuId) {  	case MENU_INVENTORY: -		_inventoryStringArray[actionId].setChar(' ', 0); -		_inventoryStringArray[actionId].setChar(' ', 21); +		_inventoryStringArray[item._actionId].setChar(' ', 0); +		_inventoryStringArray[item._actionId].setChar(' ', 21);  		break;  	case MENU_MOVE: -		_moveStringArray[actionId].setChar(' ', 0); +		_moveStringArray[item._actionId].setChar(' ', 0);  		break;  	case MENU_ACTION: -		_actionStringArray[actionId].setChar(' ', 0); +		_actionStringArray[item._actionId].setChar(' ', 0);  		break;  	case MENU_SELF: -		_selfStringArray[actionId].setChar(' ', 0); +		_selfStringArray[item._actionId].setChar(' ', 0);  		break;  	case MENU_DISCUSS: -		_discussStringArray[actionId].setChar(' ', 0); +		_discussStringArray[item._actionId].setChar(' ', 0);  		break;  	default:  		break; @@ -654,7 +675,7 @@ void Menu::initMenu() {  		_inventoryMenu[i]._menuId = MENU_INVENTORY;  		_inventoryMenu[i]._actionId = i;  		if (i > 6) -			disableMenuItem(_inventoryMenu[i]._menuId, _inventoryMenu[i]._actionId); +			disableMenuItem(_inventoryMenu[i]);  	}  	_msg3 = OPCODE_NONE;  	_msg4 = OPCODE_NONE; @@ -669,13 +690,21 @@ void Menu::initMenu() {   */  void Menu::setSearchMenu() {  	for (int i = 1; i <= 7; ++i) -		disableMenuItem(MENU_MOVE, _moveMenu[i]._actionId); +		disableMenuItem(_moveMenu[i]);  	for (int i = 1; i <= 11; ++i) -		disableMenuItem(_actionMenu[i]._menuId, _actionMenu[i]._actionId); +		disableMenuItem(_actionMenu[i]); -	setText(_opcodeSound >> 8, _opcodeSound & 0xFF, _vm->getEngineString(S_SUITE)); -	setText(_opcodeLift  >> 8, _opcodeLift  & 0xFF, _vm->getEngineString(S_STOP)); +	MenuItem miSound; +	miSound._menuId   = _opcodeSound >> 8; +	miSound._actionId = _opcodeSound & 0xFF; + +	MenuItem miLift; +	miLift._menuId   = _opcodeLift >> 8; +	miLift._actionId = _opcodeLift & 0xFF; + +	setText(miSound, _vm->getEngineString(S_SUITE)); +	setText(miLift,  _vm->getEngineString(S_STOP));  }  /** @@ -685,10 +714,18 @@ void Menu::setSearchMenu() {  void Menu::unsetSearchMenu() {  	setDestinationText(_vm->_coreVar._currPlace);  	for (int i = 1; i <= 11; ++i) -		enableMenuItem(_actionMenu[i]._menuId, _actionMenu[i]._actionId); +		enableMenuItem(_actionMenu[i]); + +	MenuItem miSound; +	miSound._menuId   = _opcodeSound >> 8; +	miSound._actionId = _opcodeSound & 0xFF; + +	MenuItem miLift; +	miLift._menuId   = _opcodeLift >> 8; +	miLift._actionId = _opcodeLift & 0xFF; -	setText(_opcodeSound >> 8, _opcodeSound & 0xFF, _vm->getEngineString(S_PROBE)); -	setText(_opcodeLift  >> 8, _opcodeLift  & 0xFF, _vm->getEngineString(S_RAISE)); +	setText(miSound, _vm->getEngineString(S_PROBE)); +	setText(miLift,  _vm->getEngineString(S_RAISE));  }  /** @@ -704,15 +741,15 @@ void Menu::setInventoryText() {  			++cy;  			int r = _vm->_coreVar._inventory[i] + 400;  			nomp = _vm->getString(r - 501 + kInventoryStringIndex); -			setText(_inventoryMenu[cy]._menuId, _inventoryMenu[cy]._actionId, nomp); -			enableMenuItem(_inventoryMenu[i]._menuId, _inventoryMenu[i]._actionId); +			setText(_inventoryMenu[cy], nomp); +			enableMenuItem(_inventoryMenu[i]);  		}  	}  	if (cy < 6) {  		for (int i = cy + 1; i <= 6; ++i) { -			setText(_inventoryMenu[i]._menuId, _inventoryMenu[i]._actionId, "                       "); -			disableMenuItem(_inventoryMenu[i]._menuId, _inventoryMenu[i]._actionId); +			setText(_inventoryMenu[i], "                       "); +			disableMenuItem(_inventoryMenu[i]);  		}  	}  } diff --git a/engines/mortevielle/menu.h b/engines/mortevielle/menu.h index 9afa99cfa8..d1271bca2e 100644 --- a/engines/mortevielle/menu.h +++ b/engines/mortevielle/menu.h @@ -42,7 +42,7 @@ enum {  const int OPCODE_NONE = 0; -struct menuItem { +struct MenuItem {  	int _menuId;  	int _actionId;  }; @@ -71,9 +71,9 @@ public:  	Common::String _actionStringArray[22];  	Common::String _selfStringArray[7];  	Common::String _discussStringArray[9]; -	menuItem _discussMenu[9]; -	menuItem _inventoryMenu[9]; -	menuItem _moveMenu[8]; +	MenuItem _discussMenu[9]; +	MenuItem _inventoryMenu[9]; +	MenuItem _moveMenu[8];  	int _opcodeAttach;  	int _opcodeWait; @@ -101,15 +101,15 @@ public:  	int _opcodeSRead;  	int _opcodeSPut;  	int _opcodeSLook; -	menuItem _actionMenu[12]; +	MenuItem _actionMenu[12];  	void setParent(MortevielleEngine *vm);  	void readVerbNums(Common::File &f, int dataSize); -	void setText(int menuId, int actionId, Common::String name); +	void setText(MenuItem item, Common::String name);  	void setDestinationText(int roomId);  	void setInventoryText(); -	void disableMenuItem(int menuId, int actionId); -	void enableMenuItem(int menuId, int actionId); +	void disableMenuItem(MenuItem item); +	void enableMenuItem(MenuItem item);  	void displayMenu();  	void drawMenu();  	void menuUp(int msgId); diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index c9eebe1347..4c9e57acd1 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -130,16 +130,6 @@ enum Places {  	DOOR = 25,        ROOM26 = 26,      COAT_ARMS = 27  }; -struct nhom { -	byte _id;     /* number between 0 and 32 */ -	byte _hom[4]; -}; - -struct CgaPalette { -	byte _p; -	nhom _a[16]; -}; -  struct Pattern {  	byte _tay, _tax;  	byte _des[kMaxPatt + 1][kMaxPatt + 1]; @@ -179,7 +169,6 @@ private:  	Common::StringArray _engineStrings;  	Common::StringArray _gameStrings; -	Pattern _patternArr[15];  	int _menuOpcode;  	bool _inMainGameLoop;	// Flag when the main game loop is active @@ -223,7 +212,6 @@ private:  	int  _startHour;  	int  _endHour;  	Common::Point _stdPal[91][17]; -	CgaPalette _cgaPal[91];  	int  _x26KeyCount;  	int  _roomDoorId; @@ -256,7 +244,6 @@ private:  	void mainGame();  	void playGame();  	void handleAction(); -	void displayCGAPattern(int n, Pattern *p, nhom *pal);  	void loadPalette();  	void loadTexts();  	void loadCFIEC(); diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 4629a47c36..d50f4005de 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -164,8 +164,6 @@ void TextHandler::loadAniFile(Common::String filename, int32 skipSize, int lengt  }  void TextHandler::taffich() { -	static const byte rang[16] = {15, 14, 11, 7, 13, 12, 10, 6, 9, 5, 3, 1, 2, 4, 8, 0}; -  	static const byte tran1[] = { 121, 121, 138, 139, 120 };  	static const byte tran2[] = { 150, 150, 152, 152, 100, 110, 159, 100, 100 }; diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 52e3b7c29b..f138dde5c5 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -502,48 +502,48 @@ void MortevielleEngine::showPeoplePresent(int bitIndex) {  	int xp = 580 - (_screenSurface.getStringWidth("LEO") / 2);  	for (int i = 1; i <= 8; ++i) -		_menu.disableMenuItem(_menu._discussMenu[i]._menuId, _menu._discussMenu[i]._actionId); +		_menu.disableMenuItem(_menu._discussMenu[i]);  	clearUpperRightPart();  	if ((bitIndex & 128) == 128) {  		_screenSurface.putxy(xp, 24);  		_screenSurface.drawString("LEO", 4); -		_menu.enableMenuItem(_menu._discussMenu[1]._menuId, _menu._discussMenu[1]._actionId); +		_menu.enableMenuItem(_menu._discussMenu[1]);  	}  	if ((bitIndex & 64) == 64) {  		_screenSurface.putxy(xp, 32);  		_screenSurface.drawString("PAT", 4); -		_menu.enableMenuItem(_menu._discussMenu[2]._menuId, _menu._discussMenu[2]._actionId); +		_menu.enableMenuItem(_menu._discussMenu[2]);  	}  	if ((bitIndex & 32) == 32) {  		_screenSurface.putxy(xp, 40);  		_screenSurface.drawString("GUY", 4); -		_menu.enableMenuItem(_menu._discussMenu[3]._menuId, _menu._discussMenu[3]._actionId); +		_menu.enableMenuItem(_menu._discussMenu[3]);  	}  	if ((bitIndex & 16) == 16) {  		_screenSurface.putxy(xp, 48);  		_screenSurface.drawString("EVA", 4); -		_menu.enableMenuItem(_menu._discussMenu[4]._menuId, _menu._discussMenu[4]._actionId); +		_menu.enableMenuItem(_menu._discussMenu[4]);  	}  	if ((bitIndex & 8) == 8) {  		_screenSurface.putxy(xp, 56);  		_screenSurface.drawString("BOB", 4); -		_menu.enableMenuItem(_menu._discussMenu[5]._menuId, _menu._discussMenu[5]._actionId); +		_menu.enableMenuItem(_menu._discussMenu[5]);  	}  	if ((bitIndex & 4) == 4) {  		_screenSurface.putxy(xp, 64);  		_screenSurface.drawString("LUC", 4); -		_menu.enableMenuItem(_menu._discussMenu[6]._menuId, _menu._discussMenu[6]._actionId); +		_menu.enableMenuItem(_menu._discussMenu[6]);  	}  	if ((bitIndex & 2) == 2) {  		_screenSurface.putxy(xp, 72);  		_screenSurface.drawString("IDA", 4); -		_menu.enableMenuItem(_menu._discussMenu[7]._menuId, _menu._discussMenu[7]._actionId); +		_menu.enableMenuItem(_menu._discussMenu[7]);  	}  	if ((bitIndex & 1) == 1) {  		_screenSurface.putxy(xp, 80);  		_screenSurface.drawString("MAX", 4); -		_menu.enableMenuItem(_menu._discussMenu[8]._menuId, _menu._discussMenu[8]._actionId); +		_menu.enableMenuItem(_menu._discussMenu[8]);  	}  	_currBitIndex = bitIndex;  } @@ -697,7 +697,7 @@ int MortevielleEngine::getPresenceStatsRedRoom() {   */  void MortevielleEngine::displayAloneText() {  	for (int i = 1; i <= 8; ++i) -		_menu.disableMenuItem(_menu._discussMenu[i]._menuId, _menu._discussMenu[i]._actionId); +		_menu.disableMenuItem(_menu._discussMenu[i]);  	Common::String sYou = getEngineString(S_YOU);  	Common::String sAre = getEngineString(S_ARE); @@ -1949,28 +1949,11 @@ void MortevielleEngine::setPal(int n) {  }  /** - * Engine function - Display a CGA pattern, using a specified palette - * @remarks	Originally called 'outbloc' - */ -void MortevielleEngine::displayCGAPattern(int n, Pattern *p, nhom *pal) { -	int addr = n * 404 + 0xd700; - -	WRITE_LE_UINT16(&_curPict[addr], p->_tax); -	WRITE_LE_UINT16(&_curPict[addr + 2], p->_tay); -	addr += 4; -	for (int i = 0; i < p->_tax; ++i) { -		for (int j = 0; j < p->_tay; ++j) -			_curPict[addr + j * p->_tax + i] = pal[n]._hom[p->_des[i + 1][j + 1]]; -	} -} - -/**   * Engine function - Load Palette from File   * @remarks	Originally called 'charpal'   */  void MortevielleEngine::loadPalette() {  	Common::File f; -	byte b;  	if (!f.open("fxx.mor")) {  		if (f.open("mfxx.mor")) @@ -1996,27 +1979,8 @@ void MortevielleEngine::loadPalette() {  	if (!f.open("cxx.mor"))  		error("Missing file - cxx.mor"); -	for (int j = 0; j <= 90; ++j) { -		_cgaPal[j]._p = f.readByte(); -		for (int i = 0; i <= 15; ++i) { -			nhom &with = _cgaPal[j]._a[i]; +	// Skip CGA Palette and Patterns -			b = f.readByte(); -			with._id = (uint)b >> 4; -			with._hom[0] = ((uint)b >> 2) & 3; -			with._hom[1] = b & 3; -		} -	} - -	_cgaPal[10]._a[9] = _cgaPal[10]._a[5]; -	for (int j = 0; j <= 14; ++j) { -		_patternArr[j]._tax = f.readByte(); -		_patternArr[j]._tay = f.readByte(); -		for (int i = 1; i <= 20; ++i) { -			for (int k = 1; k <= 20; ++k) -				_patternArr[j]._des[i][k] = f.readByte(); -		} -	}  	f.close();  } @@ -2663,8 +2627,8 @@ void MortevielleEngine::displayItemInHand(int objId) {  	if (objId != 500)  		strp = getString(objId - 501 + kInventoryStringIndex); -	_menu.setText(_menu._inventoryMenu[8]._menuId, _menu._inventoryMenu[8]._actionId, strp); -	_menu.disableMenuItem(_menu._inventoryMenu[8]._menuId, _menu._inventoryMenu[8]._actionId); +	_menu.setText(_menu._inventoryMenu[8], strp); +	_menu.disableMenuItem(_menu._inventoryMenu[8]);  }  /** diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp index 5c148a7b57..4e14473921 100644 --- a/engines/scumm/actor.cpp +++ b/engines/scumm/actor.cpp @@ -1485,7 +1485,7 @@ void ScummEngine::playActorSounds() {  	int sound;  	for (i = 1; i < _numActors; i++) { -		if (_actors[i]->_cost.soundCounter && _actors[i]->isInCurrentRoom() && _actors[i]->_sound) { +		if (_actors[i]->_cost.soundCounter && _actors[i]->isInCurrentRoom()) {  			_currentScript = 0xFF;  			if (_game.version == 0) {  				sound = v0ActorSounds[i - 1] & 0x3F; diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp index 4c1fdaf673..4d65ccc88a 100644 --- a/engines/scumm/gfx.cpp +++ b/engines/scumm/gfx.cpp @@ -1888,7 +1888,7 @@ bool Gdi::drawStrip(byte *dstPtr, VirtScreen *vs, int x, int y, const int width,  		if (stripnr * 4 + 4 < smapLen)  			offset = READ_LE_UINT32(smap_ptr + stripnr * 4 + 4);  	} else { -		smapLen = READ_BE_UINT32(smap_ptr); +		smapLen = READ_BE_UINT32(smap_ptr + 4);  		if (stripnr * 4 + 8 < smapLen)  			offset = READ_LE_UINT32(smap_ptr + stripnr * 4 + 8);  	} diff --git a/engines/scumm/he/script_v72he.cpp b/engines/scumm/he/script_v72he.cpp index d4920cf430..42bf9a4bb6 100644 --- a/engines/scumm/he/script_v72he.cpp +++ b/engines/scumm/he/script_v72he.cpp @@ -158,7 +158,7 @@ int ScummEngine_v72he::readArray(int array, int idx2, int idx1) {  	ArrayHeader *ah = (ArrayHeader *)getResourceAddress(rtString, readVar(array)); -	if (ah == NULL || ah->data == NULL) +	if (!ah)  		error("readArray: invalid array %d (%d)", array, readVar(array));  	if (idx2 < (int)FROM_LE_32(ah->dim2start) || idx2 > (int)FROM_LE_32(ah->dim2end) || diff --git a/engines/scumm/insane/insane_enemy.cpp b/engines/scumm/insane/insane_enemy.cpp index 3876966fd1..d711b63342 100644 --- a/engines/scumm/insane/insane_enemy.cpp +++ b/engines/scumm/insane/insane_enemy.cpp @@ -1519,6 +1519,7 @@ void Insane::chooseEnemyWeaponAnim(int32 buttons) {  		case INV_BOOT:  		case INV_HAND:  		case INV_DUST: +			// fallthrough  		default:  			switchEnemyWeapon();  		} diff --git a/engines/scumm/script_v6.cpp b/engines/scumm/script_v6.cpp index a75e864e7a..6983c51f30 100644 --- a/engines/scumm/script_v6.cpp +++ b/engines/scumm/script_v6.cpp @@ -394,7 +394,7 @@ ScummEngine_v6::ArrayHeader *ScummEngine_v6::getArray(int array) {  int ScummEngine_v6::readArray(int array, int idx, int base) {  	ArrayHeader *ah = getArray(array); -	if (ah == NULL || ah->data == NULL) +	if (!ah)  		error("readArray: invalid array %d (%d)", array, readVar(array));  	// WORKAROUND bug #645711. This is clearly a script bug, as this script diff --git a/engines/tsage/converse.cpp b/engines/tsage/converse.cpp index 909da62541..8ae6a0d97e 100644 --- a/engines/tsage/converse.cpp +++ b/engines/tsage/converse.cpp @@ -858,6 +858,11 @@ void StripManager::signal() {  						++obj44Idx;  					if (_obj44List[obj44Idx]._field16[0]) { +						// WORKAROUND: The _lookupList isn't always correctly initialised. But it always +						// seems to be set to the R2_GLOBALS._stripManager_lookupList, so manually set it +						if (!_lookupList) +							_lookupList = R2_GLOBALS._stripManager_lookupList; +						  						int f16Index = _lookupList[_obj44List[obj44Idx]._field16[0] - 1];  						listId = _obj44List[obj44Idx]._field16[f16Index]; @@ -868,13 +873,16 @@ void StripManager::signal() {  							choiceStr = (const char *)&_script[0] + _obj44List[obj44Idx]._list[listIdx]._scriptOffset;  						} else { -							for (int listIdx = 0; listIdx < OBJ0A_LIST_SIZE; ++listIdx) { +							for (int listIdx = idx; listIdx < (OBJ0A_LIST_SIZE - 1); ++listIdx) {  								obj44._list[listIdx]._id = obj44._list[listIdx + 1]._id;  								obj44._list[listIdx]._scriptOffset = obj44._list[listIdx + 1]._scriptOffset;  								if (!obj44._list[listIdx + 1]._id)  									obj44._list[listIdx]._id = 0;  							} + +							--idx; +							continue;  						}  					}  				} diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index 6b4e2963a5..b5ec0edbaf 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -4242,9 +4242,10 @@ void SceneHandler::process(Event &event) {  			// Scan the item list to find one the mouse is within  			SynchronizedList<SceneItem *>::iterator i;  			for (i = g_globals->_sceneItems.begin(); i != g_globals->_sceneItems.end(); ++i) { -				if ((*i)->contains(event.mousePos)) { +				SceneItem *item = *i;				 +				if (item->contains(event.mousePos)) {  					// Pass the action to the item -					bool handled = (*i)->startAction(g_globals->_events.getCursor(), event); +					bool handled = item->startAction(g_globals->_events.getCursor(), event);  					if (!handled)  						// Item wasn't handled, keep scanning  						continue; diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp index 5c4fa967e5..598aed4682 100644 --- a/engines/tsage/globals.cpp +++ b/engines/tsage/globals.cpp @@ -404,7 +404,7 @@ void Ringworld2Globals::reset() {  	_v565E7 = 0;  	_v565E9 = -5;  	_v565EB = 26; -	_v565F5 = 0; +	_foodCount = 0;  	_v565F6 = 0;  	_v565F8 = 0;  	_v565FA = 0; @@ -449,7 +449,7 @@ void Ringworld2Globals::reset() {  	_v56613[(17 * 4) + 1] = 1;  	_v566A6 = 3800; -	_v566A3 = 2; +	_landerSuitNumber = 2;  	_v566A4 = 1;  	_v566A5 = 0;  	_v566A8 = 5; @@ -519,11 +519,11 @@ void Ringworld2Globals::synchronize(Serializer &s) {  	s.syncAsSint16LE(_v565E7);  	s.syncAsSint16LE(_v565E9);  	s.syncAsSint16LE(_v565EB); -	s.syncAsSint16LE(_v565F5); +	s.syncAsSint16LE(_foodCount);  	s.syncAsSint16LE(_v565F6);  	s.syncAsSint16LE(_v565F8);  	s.syncAsSint16LE(_v565FA); -	s.syncAsSint16LE(_v566A3); +	s.syncAsSint16LE(_landerSuitNumber);  	s.syncAsSint16LE(_v566A6);  	s.syncAsSint16LE(_v56A93);  	s.syncAsSint16LE(_scene1925CurrLevel); // _v56A9C diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h index ed27ff0556..e91a74b2ca 100644 --- a/engines/tsage/globals.h +++ b/engines/tsage/globals.h @@ -269,7 +269,7 @@ public:  	int _v565E7;  	int _v565E9;  	int _v565EB; -	int _v565F5; +	int _foodCount;  	int _v565F6;  	int _v565F8;  	int _v565FA; @@ -280,7 +280,7 @@ public:  	byte _v566A4;  	byte _v566A5;  	int _v566A6; -	byte _v566A3; +	byte _landerSuitNumber;  	byte _v566A8;  	byte _v566A9;  	byte _v566AA; diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 2a8e50bd67..a409a30a86 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -1429,6 +1429,8 @@ void SceneExit::process(Event &event) {  /*--------------------------------------------------------------------------*/  void SceneAreaObject::remove() { +	// TODO: This needs to be investigated.. SceneArea doesn't derive from SceneItem?? +//	R2_GLOBALS._sceneItems.remove(this);  	_object1.remove();  	SceneArea::remove();  	--R2_GLOBALS._insetUp; @@ -1438,19 +1440,22 @@ void SceneAreaObject::process(Event &event) {  	if (_insetCount == R2_GLOBALS._insetUp) {  		CursorType cursor = R2_GLOBALS._events.getCursor(); -		if (_bounds.contains(event.mousePos)) { +		if (_object1._bounds.contains(event.mousePos)) {  			// Cursor moving in bounded area  			if (cursor == _cursorNum) {  				R2_GLOBALS._events.setCursor(_savedCursorNum);  			}  		} else if (event.mousePos.y < 168) { -			if (_cursorNum != cursor) +			if (_cursorNum != cursor) {  				// Cursor moved outside bounded area -				R2_GLOBALS._events.setCursor(_savedCursorNum); - +				_savedCursorNum = R2_GLOBALS._events.getCursor(); +				R2_GLOBALS._events.setCursor(CURSOR_INVALID); +			} +				  			if (event.eventType == EVENT_BUTTON_DOWN) { -				R2_GLOBALS._events.setCursor(_savedCursorNum);  				event.handled = true; +				R2_GLOBALS._events.setCursor(_savedCursorNum); +				remove();  			}  		}  	} @@ -1470,7 +1475,7 @@ void SceneAreaObject::setDetails(int visage, int strip, int frameNumber, const C  }  void SceneAreaObject::setDetails(int resNum, int lookLineNum, int talkLineNum, int useLineNum) { -	((SceneHotspot *)(this))->setDetails(resNum, lookLineNum, talkLineNum, useLineNum, +	_object1.setDetails(resNum, lookLineNum, talkLineNum, useLineNum,  		2, (SceneItem *)NULL);  } diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index 8d35fc7222..1221e73f5f 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -392,11 +392,11 @@ void Scene100::dispatch() {   *   *--------------------------------------------------------------------------*/ -bool Scene125::Object5::startAction(CursorType action, Event &event) { +bool Scene125::Food::startAction(CursorType action, Event &event) {  	if (action == CURSOR_USE)  		return true; -	else -		return SceneActor::startAction(action, event); + +	return SceneActor::startAction(action, event);  }  /*--------------------------------------------------------------------------*/ @@ -631,9 +631,9 @@ void Scene125::postInit(SceneObjectList *OwnerList) {  		_infoDisk.setPosition(Common::Point(47, 167));  	} -	_object6.postInit(); -	_object6.setup(162, 1, 1); -	_object6.setPosition(Common::Point(214, 168)); +	_foodDispenser.postInit(); +	_foodDispenser.setup(162, 1, 1); +	_foodDispenser.setPosition(Common::Point(214, 168));  	_diskSlot.setDetails(Rect(27, 145, 81, 159), 126, 9, -1, -1, 1, NULL);  	_item3.setDetails(Rect(144, 119, 286, 167), 126, 6, 7, 8, 1, NULL); @@ -656,8 +656,8 @@ void Scene125::signal() {  		_icon4.postInit();  		_icon4._sceneRegionId = 5; -		_sceneMode = 2;  		setAction(&_sequenceManager, this, 127, &_icon1, &_icon2, &_icon3, &_icon4, &R2_GLOBALS._player, NULL); +		_sceneMode = 2;  		break;  	case 2:  		_icon1.setup(160, 1, 1); @@ -698,7 +698,7 @@ void Scene125::signal() {  		_icon6._sceneRegionId = 8;  		consoleAction(5); -		R2_GLOBALS._player.enableControl(); +		R2_GLOBALS._player.enableControl(CURSOR_USE);  		R2_GLOBALS._player._canWalk = false;  		break;  	case 10: @@ -971,14 +971,17 @@ void Scene125::consoleAction(int id) {  	case 15:  		consoleAction(3); -		if (R2_GLOBALS._v565F5 < 3) { +		if (R2_GLOBALS._foodCount < 3) {  			R2_GLOBALS._player.disableControl(); -			_object5.postInit(); -			_object5.setup(162, 2, 2); -			_object5.setPosition(Common::Point(216, UI_INTERFACE_Y)); +			_food.postInit(); +			_food.setup(162, 2, 2); +			_food.setPosition(Common::Point(216, UI_INTERFACE_Y)); + +			R2_GLOBALS._foodCount += 2; -			R2_GLOBALS._v565F5 += 2; -		} else if (R2_GLOBALS._v565F5 == 3) { +			_sceneMode = 128; +			this->setAction(&_sequenceManager, this, 128, &_foodDispenser, &_food, NULL); +		} else if (R2_GLOBALS._foodCount == 3) {  			SceneItem::display2(126, 13);  		} else {  			SceneItem::display2(126, 14); @@ -987,13 +990,16 @@ void Scene125::consoleAction(int id) {  	case 16:  		consoleAction(3); -		if (R2_GLOBALS._v565F5 < 4) { +		if (R2_GLOBALS._foodCount < 4) {  			R2_GLOBALS._player.disableControl(); -			_object5.postInit(); -			_object5.setup(162, 2, 3); -			_object5.setPosition(Common::Point(218, UI_INTERFACE_Y)); +			_food.postInit(); +			_food.setup(162, 2, 3); +			_food.setPosition(Common::Point(218, UI_INTERFACE_Y)); -			++R2_GLOBALS._v565F5; +			++R2_GLOBALS._foodCount; + +			_sceneMode = 128; +			this->setAction(&_sequenceManager, this, 128, &_foodDispenser, &_food, NULL);  		} else {  			SceneItem::display2(126, 15);  		} @@ -1001,13 +1007,16 @@ void Scene125::consoleAction(int id) {  	case 17:  		consoleAction(3); -		if (R2_GLOBALS._v565F5 < 4) { +		if (R2_GLOBALS._foodCount < 4) {  			R2_GLOBALS._player.disableControl(); -			_object5.postInit(); -			_object5.setup(162, 2, 1); -			_object5.setPosition(Common::Point(215, UI_INTERFACE_Y)); +			_food.postInit(); +			_food.setup(162, 2, 1); +			_food.setPosition(Common::Point(215, UI_INTERFACE_Y)); + +			++R2_GLOBALS._foodCount; -			++R2_GLOBALS._v565F5; +			_sceneMode = 128; +			this->setAction(&_sequenceManager, this, 128, &_foodDispenser, &_food, NULL);  		} else {  			SceneItem::display2(126, 16);  		} @@ -2026,7 +2035,7 @@ void Scene200::EastExit::changeScene() {  	Scene200 *scene = (Scene200 *)R2_GLOBALS._sceneManager._scene;  	_enabled = false; -	R2_GLOBALS._player.disableControl(); +	R2_GLOBALS._player.disableControl(CURSOR_WALK);  	scene->_sceneMode = 206;  	scene->setAction(&scene->_sequenceManager, scene, 206, &R2_GLOBALS._player, NULL);  } @@ -2035,7 +2044,7 @@ void Scene200::WestExit::changeScene() {  	Scene200 *scene = (Scene200 *)R2_GLOBALS._sceneManager._scene;  	_enabled = false; -	R2_GLOBALS._player.disableControl(); +	R2_GLOBALS._player.disableControl(CURSOR_WALK);  	scene->_sceneMode = 208;  	scene->setAction(&scene->_sequenceManager, scene, 208, &R2_GLOBALS._player, NULL);  } @@ -3142,7 +3151,7 @@ bool Scene300::Doorway::startAction(CursorType action, Event &event) {  	if (action == CURSOR_USE) {  		if ((R2_GLOBALS._player._characterIndex == R2_QUINN) && -				(!R2_GLOBALS.getFlag(44) || R2_GLOBALS._player._characterScene[R2_MIRANDA] == 500)) { +				(!R2_GLOBALS.getFlag(44) || R2_GLOBALS._player._characterScene[R2_SEEKER] == 500)) {  			R2_GLOBALS._player.disableControl();  			scene->_sceneMode = 301;  			scene->setAction(&scene->_sequenceManager1, scene, 301, &R2_GLOBALS._player, this, NULL); @@ -3559,7 +3568,7 @@ void Scene300::signal() {  		break;  	case 16: -		if (_stripManager._field2E8 == 1) { +		if (_stripManager._exitMode == 1) {  			R2_GLOBALS._player.setAction(NULL);  			R2_GLOBALS._sceneManager.changeScene(1000);  		} else { @@ -4853,7 +4862,7 @@ bool Scene500::Object2::startAction(CursorType action, Event &event) {  	}  } -bool Scene500::Object3::startAction(CursorType action, Event &event) { +bool Scene500::Suit::startAction(CursorType action, Event &event) {  	Scene500 *scene = (Scene500 *)R2_GLOBALS._sceneManager._scene;  	switch (action) { @@ -4877,7 +4886,7 @@ bool Scene500::Object3::startAction(CursorType action, Event &event) {  			else {  				R2_GLOBALS._player.disableControl();  				scene->_sceneMode = 512; -				scene->setAction(&scene->_sequenceManager1, scene, 524, &R2_GLOBALS._player, &scene->_object3, NULL); +				scene->setAction(&scene->_sequenceManager1, scene, 524, &R2_GLOBALS._player, &scene->_suit, NULL);  				R2_GLOBALS.setFlag(26);  			}  		} else { @@ -4893,7 +4902,7 @@ bool Scene500::Object3::startAction(CursorType action, Event &event) {  		else {  			R2_GLOBALS._player.disableControl();  			scene->_sceneMode = 515; -			scene->setAction(&scene->_sequenceManager1, scene, 515, &R2_GLOBALS._player, &scene->_object3, NULL); +			scene->setAction(&scene->_sequenceManager1, scene, 515, &R2_GLOBALS._player, &scene->_suit, NULL);  			R2_GLOBALS.setFlag(28);  		}  		return true; @@ -5045,7 +5054,36 @@ bool Scene500::Locker2::startAction(CursorType action, Event &event) {  	}  } -bool Scene500::Object::startAction(CursorType action, Event &event) { +/*--------------------------------------------------------------------------*/ + +void Scene500::PanelDialog::setDetails(int visage, int strip, int frameNumber,  +		const Common::Point &pt) { +	SceneAreaObject::setDetails(visage, strip, frameNumber, pt); +	SceneAreaObject::setDetails(500, 43, 32, 45); + +	_button1.setupButton(1); +	_button2.setupButton(2); +	_button3.setupButton(3); +} + +void Scene500::PanelDialog::remove() { +	Scene500 *scene = (Scene500 *)BF_GLOBALS._sceneManager._scene; +	scene->_sceneAreas.remove(&_button1); +	scene->_sceneAreas.remove(&_button2); +	scene->_sceneAreas.remove(&_button3); + +	_button1.remove(); +	_button2.remove(); +	_button3.remove(); + +	SceneAreaObject::remove(); + +	R2_GLOBALS._player.disableControl(); +	scene->_sceneMode = 511; +	scene->setAction(&scene->_sequenceManager1, scene, 511, &R2_GLOBALS._player, NULL); +} + +bool Scene500::PanelDialog::Button::startAction(CursorType action, Event &event) {  	if (action == CURSOR_USE) {  		return false;  	} else { @@ -5053,6 +5091,119 @@ bool Scene500::Object::startAction(CursorType action, Event &event) {  	}  } +void Scene500::PanelDialog::Button::setupButton(int buttonId) { +	_buttonId = buttonId; +	_buttonDown = false; +	SceneActor::postInit(); +	setup(500, 7, 1); +	fixPriority(251); + +	switch (_buttonId) { +	case 1: +		setPosition(Common::Point(139, 78)); +		break; +	case 2: +		setPosition(Common::Point(139, 96)); +		break; +	case 3: +		setPosition(Common::Point(139, 114)); +		break; +	default: +		break; +	} + +	Scene500 *scene = (Scene500 *)BF_GLOBALS._sceneManager._scene; +	scene->_sceneAreas.push_front(this); +} + +void Scene500::PanelDialog::Button::synchronize(Serializer &s) { +	SceneActor::synchronize(s); + +	s.syncAsSint16LE(_buttonId); +	s.syncAsSint16LE(_buttonDown); +} + +void Scene500::PanelDialog::Button::process(Event &event) { +	if ((event.eventType == EVENT_BUTTON_DOWN) &&  +			(R2_GLOBALS._events.getCursor() == CURSOR_USE) && +			_bounds.contains(event.mousePos) && !_buttonDown) { +		_buttonDown = true; +		event.handled = true; +		setFrame(2); +	} + +	if ((event.eventType == EVENT_BUTTON_UP) && _buttonDown) { +		setFrame(1); +		_buttonDown = false; +		event.handled = true; + +		doButtonPress(); +	} +} + +void Scene500::PanelDialog::Button::doButtonPress() { +	Scene500 *scene = (Scene500 *)R2_GLOBALS._sceneManager._scene; + +	if (R2_GLOBALS.getFlag(28)) { +		SceneItem::display2(500, 48); +	} else { +		R2_GLOBALS._player.disableControl(); +		scene->_sceneMode = _buttonId; + +		switch (_buttonId) { +		case 1: +			if (--R2_GLOBALS._landerSuitNumber == 0) +				R2_GLOBALS._landerSuitNumber = 3; + +			if (R2_GLOBALS.getFlag(35)) { +				scene->_sceneMode = 5; +				scene->setAction(&scene->_sequenceManager1, scene, 509, &scene->_object1, +					&scene->_suit, &scene->_object8, NULL); +			} else { +				scene->_sound1.play(127); +				scene->_object1.animate(ANIM_MODE_6, scene); +			} +			break; + +		case 2: +			if (++R2_GLOBALS._landerSuitNumber == 4) +				R2_GLOBALS._v566A4 = 1; + +			if (R2_GLOBALS.getFlag(35)) { +				scene->_sceneMode = 6; +				scene->setAction(&scene->_sequenceManager1, scene, 509, &scene->_object1, +					&scene->_suit, &scene->_object8, NULL); +			} else { +				scene->_sound1.play(127); +				scene->_object1.animate(ANIM_MODE_6, scene); +			} +			break; +		 +		case 3: +			if (R2_GLOBALS.getFlag(35)) { +				scene->_sceneMode = 509; +				scene->setAction(&scene->_sequenceManager1, scene, 509, &scene->_object1, +					&scene->_suit, &scene->_object8, NULL); +			} else { +				scene->_suit.postInit(); +				scene->_suit.hide(); +				scene->_suit._effect = 1; +				scene->_suit.setDetails(500, -1, -1, -1, 2, (SceneItem *)NULL); +				scene->_suit.setup(502, R2_GLOBALS._landerSuitNumber + 2, 1); + +				scene->setAction(&scene->_sequenceManager1, scene, 508, +					&R2_GLOBALS._player, &scene->_object1, &scene->_suit,  +					&scene->_object8, NULL); +				R2_GLOBALS.setFlag(35); +			} +			break; + +		default: +			break; +		} +	} +} +  /*--------------------------------------------------------------------------*/  void Scene500::postInit(SceneObjectList *OwnerList) { @@ -5167,16 +5318,16 @@ void Scene500::postInit(SceneObjectList *OwnerList) {  	} else {  		_object8.setup(500, 8, 7); -		_object3.postInit(); -		_object3._effect = 1; -		_object3.setPosition(Common::Point(247, 52)); -		_object3.setDetails(500, -1, -1, -1, 2, (SceneItem *)NULL); +		_suit.postInit(); +		_suit._effect = 1; +		_suit.setPosition(Common::Point(247, 52)); +		_suit.setDetails(500, -1, -1, -1, 2, (SceneItem *)NULL);  		if (!R2_GLOBALS.getFlag(26)) {  			if (R2_GLOBALS.getFlag(28)) -				_object3.setup(502, 7, 2); +				_suit.setup(502, 7, 2);  			else -				_object3.setup(502, R2_GLOBALS._v566A3 + 2, 7); +				_suit.setup(502, R2_GLOBALS._landerSuitNumber + 2, 7);  		}  	} @@ -5222,7 +5373,7 @@ void Scene500::signal() {  		_object1.animate(ANIM_MODE_6, this);  		R2_GLOBALS.clearFlag(35); -		_object3.remove(); +		_suit.remove();  		R2_GLOBALS._player.enableControl();  		break;  	case 6: @@ -5231,7 +5382,7 @@ void Scene500::signal() {  		_object1.animate(ANIM_MODE_5, this);  		R2_GLOBALS.clearFlag(35); -		_object3.remove(); +		_suit.remove();  		R2_GLOBALS._player.enableControl();  		break;  	case 7: @@ -5239,7 +5390,7 @@ void Scene500::signal() {  		_object8.animate(ANIM_MODE_6, this);  		R2_GLOBALS.clearFlag(35); -		_object3.remove(); +		_suit.remove();  		R2_GLOBALS._player.enableControl();  		break;  	case 500: @@ -5287,12 +5438,12 @@ void Scene500::signal() {  		break;  	case 509:  		R2_GLOBALS.clearFlag(35); -		_object3.remove(); +		_suit.remove();  		R2_GLOBALS._player.enableControl();  		break;  	case 510:  		R2_GLOBALS._player.enableControl(); -		_area1.setDetails(500, 6, 1, Common::Point(160, 120)); +		_panelDialog.setDetails(500, 6, 1, Common::Point(160, 120));  		R2_GLOBALS._player.enableControl();  		break;  	case 513: diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.h b/engines/tsage/ringworld2/ringworld2_scenes0.h index bc30743aca..a3eaf56d16 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.h +++ b/engines/tsage/ringworld2/ringworld2_scenes0.h @@ -102,7 +102,7 @@ public:  class Scene125: public SceneExt {  	/* Objects */ -	class Object5: public SceneActor { +	class Food: public SceneActor {  	public:  		virtual bool startAction(CursorType action, Event &event);  	}; @@ -136,7 +136,7 @@ public:  	ASoundExt _sound1;  	NamedHotspot _background, _item2, _item3;  	DiskSlot _diskSlot; -	SceneActor _object1, _object2, _object3, _object4, _object5, _object6, _infoDisk; +	SceneActor _object1, _object2, _object3, _object4, _food, _foodDispenser, _infoDisk;  	Icon _icon1, _icon2, _icon3, _icon4, _icon5,  _icon6;  	SequenceManager _sequenceManager;  	SceneText _sceneText; @@ -524,6 +524,30 @@ public:  };  class Scene500: public SceneExt { +	/* Dialogs */ +	class PanelDialog: public SceneAreaObject { +		class Button: public SceneActor { +		private: +			int _buttonId; +			bool _buttonDown; + +			void doButtonPress();		 +		public: +			virtual Common::String getClassName() { return "Scene500_Button"; } +			virtual void process(Event &event); +			virtual bool startAction(CursorType action, Event &event); +			virtual void synchronize(Serializer &s); + +			void setupButton(int buttonId); +		}; +	public: +		Button _button1, _button2, _button3; + +		virtual Common::String getClassName() { return "Scene500_PanelWindow"; } +		virtual void remove(); +		void setDetails(int visage, int strip, int frameNumber, const Common::Point &pt); +	}; +  	/* Items */  	class ControlPanel: public SceneHotspot {  	public: @@ -535,7 +559,7 @@ class Scene500: public SceneExt {  	public:  		virtual bool startAction(CursorType action, Event &event);  	}; -	class Object3: public SceneActor { +	class Suit: public SceneActor {  	public:  		virtual bool startAction(CursorType action, Event &event);  	}; @@ -570,10 +594,6 @@ class Scene500: public SceneExt {  	public:  		virtual bool startAction(CursorType action, Event &event);  	}; -	class Object: public SceneActor { -	public: -		virtual bool startAction(CursorType action, Event &event); -	};  public:  	int _stripNumber;  	byte _buffer[2710]; @@ -583,7 +603,7 @@ public:  	ControlPanel _controlPanel;  	SceneActor _object1;  	Object2 _object2; -	Object3 _object3; +	Suit _suit;  	Doorway _doorway;  	OxygenTanks _tanks1, _tanks2;  	AirLock _airLock; @@ -592,8 +612,7 @@ public:  	SonicStunner _sonicStunner;  	Locker1 _locker1;  	Locker2 _locker2; -	SceneAreaObject _area1; -	Object _obj1, _obj2, _obj3; +	PanelDialog _panelDialog;  	ASoundExt _sound1;  	SequenceManager _sequenceManager1, _sequenceManager2;  public: diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index 021ccd44dc..4e9d019f01 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -1203,7 +1203,7 @@ void Scene1100::signal() {  		}  		break;  	case 54: -		if (_stripManager._field2E8 == 1) { +		if (_stripManager._exitMode == 1) {  			R2_GLOBALS._player.disableControl();  			_sceneMode = 1125;  			setAction(&_sequenceManager1, this, 1125, &R2_GLOBALS._player, &_seeker, NULL); diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index 561c0244a2..2abf4a545d 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -521,6 +521,12 @@ void ThemeEngine::setGraphicsMode(GraphicsMode mode) {  	delete _vectorRenderer;  	_vectorRenderer = Graphics::createRenderer(mode);  	_vectorRenderer->setSurface(&_screen); + +	// Since we reinitialized our screen surfaces we know nothing has been +	// drawn so far. Sometimes we still end up with dirty screen bits in the +	// list. Clearing it avoids invalid overlay writes when the backend +	// resizes the overlay. +	_dirtyScreen.clear();  }  void WidgetDrawData::calcBackgroundOffset() { diff --git a/video/avi_decoder.cpp b/video/avi_decoder.cpp index 92a60fcccf..34bc8c4a7a 100644 --- a/video/avi_decoder.cpp +++ b/video/avi_decoder.cpp @@ -65,9 +65,10 @@ namespace Video {  #define ID_VEDT MKTAG('v','e','d','t')  #define ID_IDX1 MKTAG('i','d','x','1')  #define ID_STRD MKTAG('s','t','r','d') -//#define ID_INFO MKTAG('I','N','F','O') +#define ID_INFO MKTAG('I','N','F','O')  #define ID_ISFT MKTAG('I','S','F','T')  #define ID_DISP MKTAG('D','I','S','P') +#define ID_PRMI MKTAG('P','R','M','I')  // Codec tags  #define ID_RLE  MKTAG('R','L','E',' ') @@ -170,15 +171,25 @@ void AVIDecoder::handleList(uint32 listSize) {  	debug(0, "Found LIST of type %s", tag2str(listType)); -	if (listType == ID_MOVI) { -		// If we found the movie block +	switch (listType) { +	case ID_MOVI: // Movie List +		// We found the movie block  		_foundMovieList = true;  		_movieListStart = curPos;  		_fileStream->skip(listSize);  		return; -	} else if (listType == ID_HDRL) { +	case ID_HDRL: // Header List  		// Mark the header as decoded  		_decodedHeader = true; +		break; +	case ID_INFO: // Metadata +	case ID_PRMI: // Unknown metadata, should be safe to ignore +		// Ignore metadata +		_fileStream->skip(listSize); +		return; +	case ID_STRL: // Stream list +	default:      // (Just hope we can parse it!) +		break;  	}  	while ((_fileStream->pos() - curPos) < listSize) | 
