diff options
| -rw-r--r-- | engines/neverhood/gamemodule.cpp | 64 | ||||
| -rw-r--r-- | engines/neverhood/gamemodule.h | 1 | ||||
| -rw-r--r-- | engines/neverhood/gamevars.h | 18 | ||||
| -rw-r--r-- | engines/neverhood/module1000.cpp | 6 | ||||
| -rw-r--r-- | engines/neverhood/module1200.cpp | 23 | ||||
| -rw-r--r-- | engines/neverhood/module1200.h | 2 | ||||
| -rw-r--r-- | engines/neverhood/module1400.cpp | 6 | ||||
| -rw-r--r-- | engines/neverhood/module1600.cpp | 2 | ||||
| -rw-r--r-- | engines/neverhood/module1900.cpp | 2 | ||||
| -rw-r--r-- | engines/neverhood/module2000.cpp | 2 | ||||
| -rw-r--r-- | engines/neverhood/module2700.cpp | 4 | ||||
| -rw-r--r-- | engines/neverhood/module2800.cpp | 132 | ||||
| -rw-r--r-- | engines/neverhood/module2800.h | 8 | ||||
| -rw-r--r-- | engines/neverhood/module2900.cpp | 24 | ||||
| -rw-r--r-- | engines/neverhood/module2900.h | 2 | 
15 files changed, 161 insertions, 135 deletions
diff --git a/engines/neverhood/gamemodule.cpp b/engines/neverhood/gamemodule.cpp index da432c5dbb..1c8a2d9a6d 100644 --- a/engines/neverhood/gamemodule.cpp +++ b/engines/neverhood/gamemodule.cpp @@ -276,29 +276,31 @@ void GameModule::initScene2401Vars() {  } -void GameModule::initScene2808Vars1() { - -	// Exit if it's already initialized -	if (getSubVar(VA_IS_PUZZLE_INIT, 0x20479010)) -		return; - -	for (uint i = 0; i < 3; i++) -		setSubVar(VA_GOOD_TEST_TUBES_LEVEL_1, i, _vm->_rnd->getRandomNumber(3 - 1) + 1); - -	setSubVar(VA_IS_PUZZLE_INIT, 0x20479010, 1); +void GameModule::initScene2801Vars() { +	if (!getSubVar(VA_IS_PUZZLE_INIT, 0x08C80800)) { +		int currMusicIndex = _vm->_rnd->getRandomNumber(5 - 1) + 3; +		setGlobalVar(V_GOOD_RADIO_MUSIC_INDEX, 5 * currMusicIndex); +		setGlobalVar(V_GOOD_RADIO_MUSIC_NAME, kScene2801MusicFileHashes[currMusicIndex]); +		setGlobalVar(V_RADIO_ROOM_LEFT_DOOR, 1); +		setGlobalVar(V_RADIO_ROOM_RIGHT_DOOR, 0); +		setSubVar(VA_IS_PUZZLE_INIT, 0x08C80800, 1); +  	} +} +void GameModule::initScene2808Vars1() { +	if (!getSubVar(VA_IS_PUZZLE_INIT, 0x20479010)) { +		for (uint i = 0; i < 3; i++) +			setSubVar(VA_GOOD_TEST_TUBES_LEVEL_1, i, _vm->_rnd->getRandomNumber(3 - 1) + 1); +		setSubVar(VA_IS_PUZZLE_INIT, 0x20479010, 1); +	}  }  void GameModule::initScene2808Vars2() { - -	// Exit if it's already initialized -	if (getSubVar(VA_IS_PUZZLE_INIT, 0x66059818)) -		return; - -	for (uint i = 0; i < 3; i++) -		setSubVar(VA_GOOD_TEST_TUBES_LEVEL_2, i, _vm->_rnd->getRandomNumber(6 - 1) + 1); - -	setSubVar(VA_IS_PUZZLE_INIT, 0x66059818, 1); +	if (!getSubVar(VA_IS_PUZZLE_INIT, 0x66059818)) { +		for (uint i = 0; i < 3; i++) +			setSubVar(VA_GOOD_TEST_TUBES_LEVEL_2, i, _vm->_rnd->getRandomNumber(6 - 1) + 1); +		setSubVar(VA_IS_PUZZLE_INIT, 0x66059818, 1); +	}  }  void GameModule::initScene3009Vars() { @@ -312,8 +314,8 @@ void GameModule::initScene3009Vars() {  }  uint32 GameModule::getScene2802MusicFileHash() { -	uint musicNum = getGlobalVar(0x08CC0828); -	return (musicNum % 5 != 0) ? 0 : kScene2801MusicFileHashes[CLIP<uint>(musicNum / 5, 0, 17)]; +	uint musicIndex = getGlobalVar(V_CURR_RADIO_MUSIC_INDEX); +	return (musicIndex % 5 != 0) ? 0 : kScene2801MusicFileHashes[CLIP<uint>(musicIndex / 5, 0, 17)];  } @@ -347,19 +349,21 @@ void GameModule::startup() {  	// DEBUG>>>  	/*  	setGlobalVar(V_SEEN_MUSIC_BOX, 1); -	setGlobalVar(0x0A18CA33, 0); -	setGlobalVar(0x0112090A, 0); -	//setGlobalVar(0x000CF819, 1); +	setGlobalVar(V_CREATURE_EXPLODED, 0); +	setGlobalVar(V_MATCH_STATUS, 0);  	setGlobalVar(V_PROJECTOR_LOCATION, 2);  	*/  	//setGlobalVar(V_ENTRANCE_OPEN, 0);  	//setGlobalVar(V_DOOR_SPIKES_OPEN, 1); +	setGlobalVar(V_CREATURE_ANGRY, 1); +	setGlobalVar(V_RADIO_ENABLED, 1); +	setGlobalVar(V_TNT_DUMMY_BUILT, 1);  	// <<<DEBUG  #if 1  	_vm->gameState().which = 0; -	_vm->gameState().sceneNum = 2; -	createModule(2800, -1); +	_vm->gameState().sceneNum = 0; +	createModule(1200, -1);  #endif  #if 0  	_vm->gameState().sceneNum = 0; @@ -503,7 +507,7 @@ void GameModule::createModule(int moduleNum, int which) {  	case 2900:  		setGlobalVar(V_MODULE_NAME, 0x81100020);  		if (which >= 0) -			setGlobalVar(0x0152899A, which); +			setGlobalVar(V_TELEPORTER_CURR_LOCATION, which);  		_childObject = new Module2900(_vm, this, which);  		break;  	case 3000: @@ -719,7 +723,7 @@ void GameModule::updateModule() {  					createModule(1100, 1);  					break;  				case 3: -					setSubVar(0x2C145A98, 2, 1); +					setSubVar(V_TELEPORTER_DEST_AVAILABLE, 2, 1);  					createModule(1700, 1);  					break;  				case 4: @@ -731,7 +735,7 @@ void GameModule::updateModule() {  					break;  				}  			} else { -				switch (getGlobalVar(0x0152899A)) { +				switch (getGlobalVar(V_TELEPORTER_CURR_LOCATION)) {  				case 0:  					createModule(1300, 6);  					break; @@ -753,7 +757,7 @@ void GameModule::updateModule() {  					break;  				}  			} -			setGlobalVar(0x0152899A, 0); +			setGlobalVar(V_TELEPORTER_CURR_LOCATION, 0);  			break;  		case 3000:  			if (_moduleResult == 1) { diff --git a/engines/neverhood/gamemodule.h b/engines/neverhood/gamemodule.h index 94fafc8796..275e8d3895 100644 --- a/engines/neverhood/gamemodule.h +++ b/engines/neverhood/gamemodule.h @@ -42,6 +42,7 @@ public:  	void initScene1307Vars();  	void initScene1405Vars();  	void initScene2401Vars(); +	void initScene2801Vars();  	void initScene2808Vars1();  	void initScene2808Vars2();  	void initScene3009Vars(); diff --git a/engines/neverhood/gamevars.h b/engines/neverhood/gamevars.h index 19a8a8586a..3e32803acc 100644 --- a/engines/neverhood/gamevars.h +++ b/engines/neverhood/gamevars.h @@ -45,7 +45,6 @@ enum {  	V_COLUMN_TEXT_NAME			= 0xC8C28808,  	V_CLICKED_COLUMN_INDEX		= 0x48A68852,  	V_CLICKED_COLUMN_ROW		= 0x49C40058, -	V_MUSIC_NAME				= 0x89A82A15,  	// Klayman  	V_KLAYMAN_SMALL				= 0x1860C990,			// Is Klayman small?  	V_KLAYMAN_FRAMEINDEX		= 0x18288913, @@ -64,10 +63,12 @@ enum {  	V_NOTES_PUZZLE_SOLVED		= 0x86615030,  	V_TILE_PUZZLE_SOLVED		= 0x404290D5,  	V_STAIRS_PUZZLE_SOLVED		= 0xA9035F60, +	V_CODE_SYMBOLS_SOLVED		= 0x2C531AF8,  	V_SPIKES_RETRACTED			= 0x18890C91,  	V_LARGE_DOOR_NUMBER			= 0x9A500914,			// Number of the currently "large" door  	V_LIGHTS_ON					= 0x4D080E54,  	V_SHRINK_LIGHTS_ON			= 0x190A1D18,			// Lights on in the room with the shrinking device +	V_STAIRS_DOWN_ONCE			= 0x2050861A,			// Stairs have been down once before  	V_STAIRS_DOWN				= 0x09221A62,  	V_LADDER_DOWN				= 0x0018CA22,			// Is the ladder in the statue room down?  	V_LADDER_DOWN_ACTION		= 0x00188211, @@ -88,7 +89,16 @@ enum {  	V_TNT_DUMMY_BUILT			= 0x000CF819,			// Are all TNT parts on the dummy?  	V_TNT_DUMMY_FUSE_LIT		= 0x20A0C516,  	V_RADIO_ENABLED				= 0x4DE80AC0, -	V_CREATURE_EXPLODED			= 0x2A02C07B, +	V_SEEN_CREATURE_EXPLODE_VID	= 0x2A02C07B, +	V_CREATURE_EXPLODED			= 0x0A18CA33, +	V_UNUSED					= 0x89C669AA,			// Seems to be unused, confirmed by checking the exe for this constant value (still left in atm) +	// Radio +	V_RADIO_ROOM_LEFT_DOOR		= 0x09880D40, +	V_RADIO_ROOM_RIGHT_DOOR		= 0x08180ABC, +	V_CURR_RADIO_MUSIC_INDEX	= 0x08CC0828, +	V_GOOD_RADIO_MUSIC_INDEX	= 0x88880915, +	V_GOOD_RADIO_MUSIC_NAME		= 0x89A82A15, +	V_RADIO_MOVE_DISH_VIDEO		= 0x28D8C940,  	// Match  	V_MATCH_STATUS				= 0x0112090A,  	// Venus fly trap @@ -111,6 +121,10 @@ enum {  	V_PROJECTOR_SLOT			= 0x04A10F33,			// Projector x slot index  	V_PROJECTOR_LOCATION		= 0x04A105B3,			// Projector scene location  	V_PROJECTOR_ACTIVE			= 0x12A10DB3,			// Is the projecor projecting? +	// Teleporter +	V_TELEPORTER_CURR_LOCATION	= 0x0152899A, +	V_TELEPORTER_WHICH			= 0x60826830, +	V_TELEPORTER_DEST_AVAILABLE	= 0x2C145A98,  	// Inventory  	V_HAS_NEEDLE				= 0x31C63C51,			// Has Klayman the needle?  	V_HAS_FINAL_KEY				= 0xC0780812,			// Has Klayman the key from the diskplayer? diff --git a/engines/neverhood/module1000.cpp b/engines/neverhood/module1000.cpp index e718904cb3..461f8738d4 100644 --- a/engines/neverhood/module1000.cpp +++ b/engines/neverhood/module1000.cpp @@ -1798,11 +1798,11 @@ uint32 Scene1005::getTextIndex1() {  	} else if (getGlobalVar(V_BOLT_DOOR_UNLOCKED)) {  		if (!getGlobalVar(V_WALL_BROKEN))  			textIndex = 12; -		else if (!getGlobalVar(0x2050861A)) +		else if (!getGlobalVar(V_STAIRS_DOWN_ONCE))  			textIndex = 13;  		else if (!getGlobalVar(V_RADIO_ENABLED))  			textIndex = 50; -		else if (!getGlobalVar(0x89C669AA)) +		else if (!getGlobalVar(V_UNUSED))  			textIndex = 14;  		else if (!getGlobalVar(V_BEEN_SHRINKING_ROOM))  			textIndex = 15; @@ -1812,7 +1812,7 @@ uint32 Scene1005::getTextIndex1() {  			textIndex = 17;  	} else if (!getGlobalVar(V_FLYTRAP_RING_EATEN)) {  		textIndex = 0; -	} else if (getGlobalVar(0x0A18CA33)) { +	} else if (getGlobalVar(V_CREATURE_EXPLODED)) {  		if (!getGlobalVar(V_TILE_PUZZLE_SOLVED))  			textIndex = 4;  		else if (!getGlobalVar(V_HAS_TEST_TUBE)) diff --git a/engines/neverhood/module1200.cpp b/engines/neverhood/module1200.cpp index 99d15b970f..d106a85aea 100644 --- a/engines/neverhood/module1200.cpp +++ b/engines/neverhood/module1200.cpp @@ -60,7 +60,7 @@ void Module1200::createScene(int sceneNum, int which) {  	case 2:  		_vm->_soundMan->stopMusic(0x62222CAE, 0, 0);  		createSmackerScene(0x31890001, true, true, false); -		setGlobalVar(V_CREATURE_EXPLODED, 1); +		setGlobalVar(V_SEEN_CREATURE_EXPLODE_VID, 1);  		break;  	}  	SetUpdateHandler(&Module1200::updateScene); @@ -74,7 +74,7 @@ void Module1200::updateScene() {  			if (_moduleResult == 1) {  				createScene(1, 0);  			} else if (_moduleResult == 2) { -				if (getGlobalVar(0x0A18CA33) && !getGlobalVar(V_CREATURE_EXPLODED)) { +				if (getGlobalVar(V_CREATURE_EXPLODED) && !getGlobalVar(V_SEEN_CREATURE_EXPLODE_VID)) {  					createScene(2, -1);  				} else {  					leaveModule(1); @@ -714,7 +714,7 @@ void AsScene1201LeftDoor::stCloseDoor() {  }  Scene1201::Scene1201(NeverhoodEngine *vm, Module *parentModule, int which) -	: Scene(vm, parentModule, true), _flag(false), _asMatch(NULL), _asTntMan(NULL), +	: Scene(vm, parentModule, true), _creatureExploded(false), _asMatch(NULL), _asTntMan(NULL),  	_asCreature(NULL), _asTntManRope(NULL), _asLeftDoor(NULL), _asRightDoor(NULL), _asTape(NULL) {  	int16 topY1, topY2, topY3, topY4; @@ -772,7 +772,7 @@ Scene1201::Scene1201(NeverhoodEngine *vm, Module *parentModule, int which)  		insertKlayman<KmScene1201>(400, 329);  		setMessageList(0x004AEC08);  	} else if (which == 2) { -		if (getGlobalVar(V_CREATURE_ANGRY) && !getGlobalVar(0x0A18CA33)) { +		if (getGlobalVar(V_CREATURE_ANGRY) && !getGlobalVar(V_CREATURE_EXPLODED)) {  			insertKlayman<KmScene1201>(374, 333);  			setMessageList(0x004AEC08);  		} else { @@ -795,7 +795,7 @@ Scene1201::Scene1201(NeverhoodEngine *vm, Module *parentModule, int which)  	_klayman->setClipRect(x1, 0, x2, 480);  	_klayman->setRepl(64, 0); -	if (getGlobalVar(V_CREATURE_ANGRY) && !getGlobalVar(0x0A18CA33)) { +	if (getGlobalVar(V_CREATURE_ANGRY) && !getGlobalVar(V_CREATURE_EXPLODED)) {  		setBackground(0x4019A2C4);  		setPalette(0x4019A2C4);  		_asRightDoor = NULL; @@ -807,7 +807,7 @@ Scene1201::Scene1201(NeverhoodEngine *vm, Module *parentModule, int which)  	if (getGlobalVar(V_TNT_DUMMY_BUILT)) {  		insertStaticSprite(0x10002ED8, 500); -		if (!getGlobalVar(0x0A18CA33)) { +		if (!getGlobalVar(V_CREATURE_EXPLODED)) {  			_asTntMan = insertSprite<AsScene1201TntMan>(this, _asTntManRope, which == 1);  			_asTntMan->setClipRect(x1, 0, x2, 480);  			_asTntMan->setRepl(64, 0); @@ -838,7 +838,7 @@ Scene1201::Scene1201(NeverhoodEngine *vm, Module *parentModule, int which)  			tntIndex += 3;  		} -		if (getGlobalVar(V_CREATURE_ANGRY) && !getGlobalVar(0x0A18CA33)) { +		if (getGlobalVar(V_CREATURE_ANGRY) && !getGlobalVar(V_CREATURE_EXPLODED)) {  			setRectList(0x004AEE58);  		} else {  			setRectList(0x004AEDC8); @@ -866,7 +866,7 @@ Scene1201::Scene1201(NeverhoodEngine *vm, Module *parentModule, int which)  			tntIndex++;  		} -		if (getGlobalVar(V_CREATURE_ANGRY) && !getGlobalVar(0x0A18CA33)) { +		if (getGlobalVar(V_CREATURE_ANGRY) && !getGlobalVar(V_CREATURE_EXPLODED)) {  			setRectList(0x004AEE18);  		} else {  			setRectList(0x004AED88); @@ -890,7 +890,7 @@ Scene1201::Scene1201(NeverhoodEngine *vm, Module *parentModule, int which)  		_vm->_collisionMan->addSprite(_asMatch);  	} -	if (getGlobalVar(V_CREATURE_ANGRY) && getGlobalVar(0x0A18CA33) == 0) { +	if (getGlobalVar(V_CREATURE_ANGRY) && getGlobalVar(V_CREATURE_EXPLODED) == 0) {  		_asCreature = insertSprite<AsScene1201Creature>(this, _klayman);  		_asCreature->setClipRect(x1, 0, x2, 480);  	} @@ -898,6 +898,9 @@ Scene1201::Scene1201(NeverhoodEngine *vm, Module *parentModule, int which)  }  Scene1201::~Scene1201() { +	if (_creatureExploded) +		setGlobalVar(V_CREATURE_EXPLODED, 1); +	setGlobalVar(V_KLAYMAN_IS_DELTA_X, _klayman->isDoDeltaX() ? 1 : 0);  }  void Scene1201::update() { @@ -911,7 +914,7 @@ uint32 Scene1201::handleMessage(int messageNum, const MessageParam ¶m, Entit  	switch (messageNum) {  	case 0x100D:  		if (param.asInteger() == 0x07053000) { -			_flag = true; +			_creatureExploded = true;  			sendMessage(_asCreature, 0x2004, 0);  		} else if (param.asInteger() == 0x140E5744) {  			sendMessage(_asCreature, 0x2005, 0); diff --git a/engines/neverhood/module1200.h b/engines/neverhood/module1200.h index bc3281c233..7d4e224a38 100644 --- a/engines/neverhood/module1200.h +++ b/engines/neverhood/module1200.h @@ -172,7 +172,7 @@ protected:  	Sprite *_asRightDoor;  	Sprite *_asTape;  	Sprite *_asKlaymanHead; -	bool _flag; +	bool _creatureExploded;  	void update();  	uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender);  }; diff --git a/engines/neverhood/module1400.cpp b/engines/neverhood/module1400.cpp index eb8f4fed87..b5489a39f9 100644 --- a/engines/neverhood/module1400.cpp +++ b/engines/neverhood/module1400.cpp @@ -917,15 +917,15 @@ Scene1402::Scene1402(NeverhoodEngine *vm, Module *parentModule, int which)  	if (_asPuzzleBox)  		_asPuzzleBox->setClipRect(0, 0, 640, _ssBridgePart3->getDrawRect().y2()); -	if (getGlobalVar(0x4A105B3) == 1) { +	if (getGlobalVar(V_PROJECTOR_LOCATION) == 1) {  		_asProjector = insertSprite<AsCommonProjector>(this, _klayman, (Sprite*)NULL);  		_vm->_collisionMan->addSprite(_asProjector); -		if (getGlobalVar(0x4A10F33) == 4) { +		if (getGlobalVar(V_PROJECTOR_SLOT) == 4) {  			sendEntityMessage(_klayman, 0x1014, _asProjector);  			_klayman->setX(_asProjector->getX() + 100);  			_klayman->processDelta();  			setMessageList(0x004B0BD0); -		} else if (getGlobalVar(0x4A10F33) == 0) { +		} else if (getGlobalVar(V_PROJECTOR_SLOT) == 0) {  			sendEntityMessage(_klayman, 0x1014, _asProjector);  			_klayman->setX(_asProjector->getX() - 100);  			_klayman->processDelta(); diff --git a/engines/neverhood/module1600.cpp b/engines/neverhood/module1600.cpp index 22ffaf64ff..b6df7061c2 100644 --- a/engines/neverhood/module1600.cpp +++ b/engines/neverhood/module1600.cpp @@ -1448,7 +1448,7 @@ uint32 Scene1609::handleMessage(int messageNum, const MessageParam ¶m, Entit  			if (_symbolPosition >= 12) {  				if (testVars()) {  					playSound(0); -					setGlobalVar(0x2C531AF8, 1); +					setGlobalVar(V_CODE_SYMBOLS_SOLVED, 1);  					_isSolved = true;  				} else {  					_symbolPosition = 0; diff --git a/engines/neverhood/module1900.cpp b/engines/neverhood/module1900.cpp index 7925c46b9a..d90074c2cf 100644 --- a/engines/neverhood/module1900.cpp +++ b/engines/neverhood/module1900.cpp @@ -105,7 +105,7 @@ Scene1901::Scene1901(NeverhoodEngine *vm, Module *parentModule, int which)  		insertStaticSprite(0x40A40168, 100);  	} else if (getGlobalVar(V_STAIRS_DOWN)) {  		insertStaticSprite(0x124404C4, 100); -		setGlobalVar(0x2050861A, 1); +		setGlobalVar(V_STAIRS_DOWN_ONCE, 1);  	} else {  		insertStaticSprite(0x02840064, 100);  	} diff --git a/engines/neverhood/module2000.cpp b/engines/neverhood/module2000.cpp index 75a6ebe899..bd5597dbf8 100644 --- a/engines/neverhood/module2000.cpp +++ b/engines/neverhood/module2000.cpp @@ -55,7 +55,7 @@ void Module2000::createScene(int sceneNum, int which) {  		break;  	case 2:  		setGlobalVar(V_WORLDS_JOINED, 1); -		setSubVar(0x2C145A98, 1, 1); +		setSubVar(V_TELEPORTER_DEST_AVAILABLE, 1, 1);  		createSmackerScene(0x204B2031, true, true, false);  		break;  	} diff --git a/engines/neverhood/module2700.cpp b/engines/neverhood/module2700.cpp index 080f8151b2..19bf9be6cb 100644 --- a/engines/neverhood/module2700.cpp +++ b/engines/neverhood/module2700.cpp @@ -458,8 +458,8 @@ void Module2700::updateScene() {  		case 21:  			if (!_flag1) {  				_vm->_soundMan->stopMusic(0x04020210, 0, 1); -				// TODO _vm->gameModule()->initScene2801Vars(); -				_musicFileHash = getGlobalVar(V_MUSIC_NAME); +				_vm->gameModule()->initScene2801Vars(); +				_musicFileHash = getGlobalVar(V_GOOD_RADIO_MUSIC_NAME);  				// TODO? GameState_sub_469C50(&field_52, 0);  				// TODO MusicMan_create(); // Why?  				_vm->_soundMan->addMusic(0x42212411, _musicFileHash); diff --git a/engines/neverhood/module2800.cpp b/engines/neverhood/module2800.cpp index a47d9cb355..b6f56945a0 100644 --- a/engines/neverhood/module2800.cpp +++ b/engines/neverhood/module2800.cpp @@ -35,7 +35,7 @@ Module2800::Module2800(NeverhoodEngine *vm, Module *parentModule, int which)  	_currentMusicFileHash = 0;  	_vm->_soundMan->addMusic(0x64210814, 0xD2FA4D14); -	setGlobalVar(0x28D8C940, 1); +	setGlobalVar(V_RADIO_MOVE_DISH_VIDEO, 1);  	if (which < 0) {  		createScene(_vm->gameState().sceneNum, which); @@ -402,7 +402,7 @@ void Module2800::updateMusic(bool halfVolume) {  Scene2801::Scene2801(NeverhoodEngine *vm, Module *parentModule, int which)  	: Scene(vm, parentModule, true) { -	// TODO _vm->gameModule()->initScene2801Vars(); +	_vm->gameModule()->initScene2801Vars();  	_surfaceFlag = true;  	SetMessageHandler(&Scene2801::handleMessage); @@ -432,7 +432,7 @@ Scene2801::Scene2801(NeverhoodEngine *vm, Module *parentModule, int which)  		setMessageList(0x004B6BB0);  	} -	if (getGlobalVar(0x09880D40)) { +	if (getGlobalVar(V_RADIO_ROOM_LEFT_DOOR)) {  		setRectList(0x004B6CE0);  		setBackground(0x01400666);  		setPalette(0x01400666); @@ -444,7 +444,7 @@ Scene2801::Scene2801(NeverhoodEngine *vm, Module *parentModule, int which)  		insertMouse433(0x0066201C);  		_asTape = insertSprite<AsScene1201Tape>(this, 8, 1100, 302, 437, 0x9148A011);  		_vm->_collisionMan->addSprite(_asTape);  -	} else if (getGlobalVar(0x08180ABC)) { +	} else if (getGlobalVar(V_RADIO_ROOM_RIGHT_DOOR)) {  		setRectList(0x004B6CD0);  		setBackground(0x11E00684);  		setPalette(0x11E00684); @@ -507,10 +507,10 @@ uint32 Scene2801::handleMessage(int messageNum, const MessageParam ¶m, Entit  }  Scene2802::Scene2802(NeverhoodEngine *vm, Module *parentModule, int which) -	: Scene(vm, parentModule, true), _countdownType(0), _countdown1(0), _countdown2(0) { +	: Scene(vm, parentModule, true), _currTuneStatus(0), _countdown1(0), _countdown2(0) {  	//DEBUG>>> Disable video -	setGlobalVar(0x28D8C940, 0); +	setGlobalVar(V_RADIO_MOVE_DISH_VIDEO, 0);  	//DEBUG<<<  	_surfaceFlag = true; @@ -518,123 +518,127 @@ Scene2802::Scene2802(NeverhoodEngine *vm, Module *parentModule, int which)  	SetUpdateHandler(&Scene2802::update);  	insertMouse435(0x008810A8, 20, 620);  	_smackerPlayer = addSmackerPlayer(new SmackerPlayer(_vm, this, 0x8284C100, true, true, true)); -	_smackerFrameNumber = getGlobalVar(0x08CC0828); -	_smackerPlayer->gotoFrame(_smackerFrameNumber); +	_currRadioMusicIndex = getGlobalVar(V_CURR_RADIO_MUSIC_INDEX); +	_smackerPlayer->gotoFrame(_currRadioMusicIndex);  	_vm->_soundMan->addSound(0x04360A18, 0x422630C2);  	_vm->_soundMan->addSound(0x04360A18, 0x00632252);  	_vm->_soundMan->addSound(0x04360A18, 0x00372241);  	_vm->_soundMan->setSoundVolume(0x00372241, 60); -	changeCountdownType(0, 0); +	changeTuneStatus(0, 0);  	_vm->_soundMan->playSoundLooping(0x00372241);  }  Scene2802::~Scene2802() {  	_vm->_soundMan->deleteSoundGroup(0x04360A18); -	if (_smackerFrameNumber == 0) { -		setGlobalVar(0x09880D40, 1); -		setGlobalVar(0x08180ABC, 0); -	} else if (_smackerFrameNumber == getGlobalVar(0x88880915)) { -		setGlobalVar(0x09880D40, 0); -		setGlobalVar(0x08180ABC, 1); +	if (_currRadioMusicIndex == 0) { +		setGlobalVar(V_RADIO_ROOM_LEFT_DOOR, 1); +		setGlobalVar(V_RADIO_ROOM_RIGHT_DOOR, 0); +	} else if (_currRadioMusicIndex == getGlobalVar(V_GOOD_RADIO_MUSIC_INDEX)) { +		setGlobalVar(V_RADIO_ROOM_LEFT_DOOR, 0); +		setGlobalVar(V_RADIO_ROOM_RIGHT_DOOR, 1);  	} else { -		setGlobalVar(0x09880D40, 0); -		setGlobalVar(0x08180ABC, 0); +		setGlobalVar(V_RADIO_ROOM_LEFT_DOOR, 0); +		setGlobalVar(V_RADIO_ROOM_RIGHT_DOOR, 0);  	} -	setGlobalVar(0x08CC0828, _smackerFrameNumber); +	setGlobalVar(V_CURR_RADIO_MUSIC_INDEX, _currRadioMusicIndex);  }  void Scene2802::update() { -	int prevCountdownType = _countdownType; -	uint prevSmackerFrameNumber = _smackerFrameNumber; +	int prevTuneStatus = _currTuneStatus; +	uint prevRadioMusicIndex = _currRadioMusicIndex;  	Scene::update();  	if (_countdown1 > 0)  		--_countdown1; -	else if (_countdownType == 1) -		_countdownType = 3; -	else if (_countdownType == 4) -		_countdownType = 6; +	else if (_currTuneStatus == 1) +		_currTuneStatus = 3; +	else if (_currTuneStatus == 4) +		_currTuneStatus = 6; -	switch (_countdownType) { +	switch (_currTuneStatus) {  	case 2: -		if (_smackerFrameNumber < 90) -			incSmackerFrameNumber(+1); -		_countdownType = 0; +		if (_currRadioMusicIndex < 90) +			incRadioMusicIndex(+1); +		_currTuneStatus = 0;  		break;  	case 3:  		if (_countdown2 > 0)  			--_countdown2; -		else if (_smackerFrameNumber < 90) { -			incSmackerFrameNumber(+1); +		else if (_currRadioMusicIndex < 90) { +			incRadioMusicIndex(+1);  			_countdown2 = 1;  		} else -			_countdownType = 0; +			_currTuneStatus = 0;  		break;  	case 5: -		if (_smackerFrameNumber > 0) -			incSmackerFrameNumber(-1); -		_countdownType = 0; +		if (_currRadioMusicIndex > 0) +			incRadioMusicIndex(-1); +		_currTuneStatus = 0;  		break;  	case 6:  		if (_countdown2 > 0)  			--_countdown2; -		else if (_smackerFrameNumber > 0) { -			incSmackerFrameNumber(-1); +		else if (_currRadioMusicIndex > 0) { +			incRadioMusicIndex(-1);  			_countdown2 = 1;  		} else -			_countdownType = 0; +			_currTuneStatus = 0;  		break;  	} -	if (prevSmackerFrameNumber != _smackerFrameNumber) -		_smackerPlayer->gotoFrame(_smackerFrameNumber); +	if (prevRadioMusicIndex != _currRadioMusicIndex) +		_smackerPlayer->gotoFrame(_currRadioMusicIndex); -	if (prevCountdownType != _countdownType) -		changeCountdownType(prevCountdownType, _countdownType); +	if (prevTuneStatus != _currTuneStatus) +		changeTuneStatus(prevTuneStatus, _currTuneStatus); +		 +	//DEBUG>>> +	debug("_currRadioMusicIndex = %d; V_GOOD_RADIO_MUSIC_INDEX = %d", _currRadioMusicIndex, getGlobalVar(V_GOOD_RADIO_MUSIC_INDEX)); +	//DEBUG<<< -	if (getGlobalVar(0x28D8C940) && prevCountdownType != _countdownType && _smackerFrameNumber != 0) { -		setGlobalVar(0x28D8C940, 0); +	if (getGlobalVar(V_RADIO_MOVE_DISH_VIDEO) && prevTuneStatus != _currTuneStatus && _currRadioMusicIndex != 0) { +		setGlobalVar(V_RADIO_MOVE_DISH_VIDEO, 0);  		leaveScene(1);  	}  }  uint32 Scene2802::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { -	int prevCountdownType = _countdownType; +	int prevTuneStatus = _currTuneStatus;  	Scene::handleMessage(messageNum, param, sender);  	switch (messageNum) {  	case 0x0001:  		if (param.asPoint().x <= 20 || param.asPoint().x >= 620) {  			leaveScene(0); -		} else if (_countdownType == 0) { +		} else if (_currTuneStatus == 0) {  			if (param.asPoint().x > 180 && param.asPoint().x < 300 &&  				param.asPoint().y > 130 && param.asPoint().y < 310) { -				_countdownType = 4; +				_currTuneStatus = 4;  			} else if (param.asPoint().x > 300 && param.asPoint().x < 400 &&  				param.asPoint().y > 130 && param.asPoint().y < 310) { -				_countdownType = 1; +				_currTuneStatus = 1;  			} -			if (_countdownType == 1 || _countdownType == 4) { +			if (_currTuneStatus == 1 || _currTuneStatus == 4) {  				_countdown1 = 8; -				changeCountdownType(0, _countdownType); +				changeTuneStatus(0, _currTuneStatus);  			}  		}  		break;  	case 0x0002:  		if (_countdown1 == 0) -			_countdownType = 0; +			_currTuneStatus = 0;  		else { -			if (_countdownType == 1) -				_countdownType = 2; -			else if (_countdownType == 4) -				_countdownType = 5; +			if (_currTuneStatus == 1) +				_currTuneStatus = 2; +			else if (_currTuneStatus == 4) +				_currTuneStatus = 5;  			else -				_countdownType = 0; +				_currTuneStatus = 0;  			_countdown1 = 0;  		} -		if (prevCountdownType != _countdownType) -			changeCountdownType(prevCountdownType, _countdownType); +		if (prevTuneStatus != _currTuneStatus) +			changeTuneStatus(prevTuneStatus, _currTuneStatus);  		break;  	case 0x000D:  		// DEBUG message @@ -643,25 +647,25 @@ uint32 Scene2802::handleMessage(int messageNum, const MessageParam ¶m, Entit  	return 0;  } -void Scene2802::incSmackerFrameNumber(int delta) { -	_smackerFrameNumber += delta; -	setGlobalVar(0x08CC0828, _smackerFrameNumber); +void Scene2802::incRadioMusicIndex(int delta) { +	_currRadioMusicIndex += delta; +	setGlobalVar(V_CURR_RADIO_MUSIC_INDEX, _currRadioMusicIndex);  } -void Scene2802::changeCountdownType(int prevCountdownType, int newCountdownType) { +void Scene2802::changeTuneStatus(int prevTuneStatus, int newTuneStatus) { -	if (prevCountdownType == 3 || prevCountdownType == 6) { +	if (prevTuneStatus == 3 || prevTuneStatus == 6) {  		_vm->_soundMan->stopSound(0x422630C2);  		_vm->_soundMan->stopSound(0x00632252);  	} -	if (newCountdownType == 0) { +	if (newTuneStatus == 0) {  		if (_vm->_gameModule->getScene2802MusicFileHash() != 0) {  			_vm->_soundMan->stopSound(0x00632252);  		}  		else  			_vm->_soundMan->playSoundLooping(0x00632252); -	} else if (newCountdownType == 3 || newCountdownType == 6) { +	} else if (newTuneStatus == 3 || newTuneStatus == 6) {  		_vm->_soundMan->playSoundLooping(0x422630C2);  		_vm->_soundMan->playSoundLooping(0x00632252);  	} diff --git a/engines/neverhood/module2800.h b/engines/neverhood/module2800.h index ca8b058ca1..bdcb1ee080 100644 --- a/engines/neverhood/module2800.h +++ b/engines/neverhood/module2800.h @@ -62,14 +62,14 @@ public:  	virtual ~Scene2802();  protected:  	SmackerPlayer *_smackerPlayer; -	uint _smackerFrameNumber; -	int _countdownType; +	uint _currRadioMusicIndex; +	int _currTuneStatus;  	int _countdown1;  	int _countdown2;  	void update();  	uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); -	void incSmackerFrameNumber(int delta); -	void changeCountdownType(int prevCountdownType, int newCountdownType); +	void incRadioMusicIndex(int delta); +	void changeTuneStatus(int prevTuneStatus, int newTuneStatus);  };  class AsScene2803LightCord : public AnimatedSprite { diff --git a/engines/neverhood/module2900.cpp b/engines/neverhood/module2900.cpp index 2ebdb094a3..0a033a8120 100644 --- a/engines/neverhood/module2900.cpp +++ b/engines/neverhood/module2900.cpp @@ -35,7 +35,7 @@ Module2900::Module2900(NeverhoodEngine *vm, Module *parentModule, int which)  	: Module(vm, parentModule) {  	if (which >= 0) -		setGlobalVar(0x60826830, which); +		setGlobalVar(V_TELEPORTER_WHICH, which);  	createScene(0, 0); @@ -47,7 +47,7 @@ void Module2900::createScene(int sceneNum, int which) {  	switch (_sceneNum) {  	case 0:  		_vm->gameState().sceneNum = 0; -		_childObject = new Scene2901(_vm, this, getGlobalVar(0x60826830)); +		_childObject = new Scene2901(_vm, this, getGlobalVar(V_TELEPORTER_WHICH));  		break;  	case 1:  		_vm->gameState().sceneNum = 0; @@ -85,8 +85,8 @@ void Module2900::updateScene() {  			if (_moduleResult == 0xFFFFFFFF) {  				leaveModule(0xFFFFFFFF);  			} else { -				_field2C = _moduleResult; -				switch (getGlobalVar(0x60826830)) { +				_teleporterModuleResult = _moduleResult; +				switch (getGlobalVar(V_TELEPORTER_WHICH)) {  				case 0:  					createScene(3, 4);  					break; @@ -117,7 +117,7 @@ void Module2900::updateScene() {  		case 4:  		case 5:  		case 6: -			leaveModule(_field2C); +			leaveModule(_teleporterModuleResult);  			break;  		}  	} @@ -391,15 +391,15 @@ Scene2901::Scene2901(NeverhoodEngine *vm, Module *parentModule, int which)  	//DEBUG>>> Enable all locations  	for (int i = 0; i < 6; i++) -		setSubVar(0x2C145A98, i, 1); +		setSubVar(V_TELEPORTER_DEST_AVAILABLE, i, 1);  	//DEBUG<<< -	setSubVar(0x2C145A98, which, 1); -	setSubVar(0x2C145A98, 5, 1); -	setSubVar(0x2C145A98, 4, 1); +	setSubVar(V_TELEPORTER_DEST_AVAILABLE, which, 1); +	setSubVar(V_TELEPORTER_DEST_AVAILABLE, 5, 1); +	setSubVar(V_TELEPORTER_DEST_AVAILABLE, 4, 1);  	if (_currLocationButtonNum == 3) -		setSubVar(0x2C145A98, 2, 1); +		setSubVar(V_TELEPORTER_DEST_AVAILABLE, 2, 1);  	_surfaceFlag = true;  	setBackground(kScene2901FileHashes1[_currLocationButtonNum]); @@ -432,7 +432,7 @@ void Scene2901::update() {  		if (_currLocationButtonNum == _selectedButtonNum) {  			_ssLocationButtonLights[_currWhirlButtonNum]->hide();  			++_currWhirlButtonNum; -			while (!getSubVar(0x2C145A98, _currWhirlButtonNum) || (_currWhirlButtonNum == 2 && _isButton2Broken) || _currLocationButtonNum == _currWhirlButtonNum) { +			while (!getSubVar(V_TELEPORTER_DEST_AVAILABLE, _currWhirlButtonNum) || (_currWhirlButtonNum == 2 && _isButton2Broken) || _currLocationButtonNum == _currWhirlButtonNum) {  				++_currWhirlButtonNum;  				if (_currWhirlButtonNum >= 6)  					_currWhirlButtonNum = 0; @@ -474,7 +474,7 @@ uint32 Scene2901::handleMessage(int messageNum, const MessageParam ¶m, Entit  			_selectedButtonNum = _currWhirlButtonNum;  		_ssLocationButtonLights[_selectedButtonNum]->hide();  		_selectedButtonNum = param.asInteger(); -		if (!getSubVar(0x2C145A98, _selectedButtonNum)) +		if (!getSubVar(V_TELEPORTER_DEST_AVAILABLE, _selectedButtonNum))  			_selectedButtonNum = _currLocationButtonNum;  		break;  	} diff --git a/engines/neverhood/module2900.h b/engines/neverhood/module2900.h index 7d4e1e4d9f..19514399e5 100644 --- a/engines/neverhood/module2900.h +++ b/engines/neverhood/module2900.h @@ -36,7 +36,7 @@ public:  	Module2900(NeverhoodEngine *vm, Module *parentModule, int which);  protected:  	int _sceneNum; -	int _field2C; +	int _teleporterModuleResult;  	void createScene(int sceneNum, int which);  	void updateScene();  	void updateMusic(bool halfVolume);  | 
