diff options
| -rw-r--r-- | engines/titanic/game/chev_code.cpp | 118 | ||||
| -rw-r--r-- | engines/titanic/messages/messages.h | 2 | ||||
| -rw-r--r-- | engines/titanic/npcs/parrot_succubus.cpp | 3 | 
3 files changed, 120 insertions, 3 deletions
diff --git a/engines/titanic/game/chev_code.cpp b/engines/titanic/game/chev_code.cpp index 4dd3ac3d4a..1feef0cad0 100644 --- a/engines/titanic/game/chev_code.cpp +++ b/engines/titanic/game/chev_code.cpp @@ -142,7 +142,123 @@ bool CChevCode::GetChevRoomNum(CGetChevRoomNum *msg) {  }  bool CChevCode::CheckChevCode(CCheckChevCode *msg) { -	// TODO +	CGetChevClassNum getClassMsg; +	CGetChevLiftNum getLiftMsg; +	CGetChevFloorNum getFloorMsg; +	CGetChevRoomNum getRoomMsg; +	CString roomName; +	int classNum = 0; +	uint bits; + +	if (_floorBits & 1) { +		switch (_floorBits) { +		case 0x1D0D9: +			roomName = "ParrLobby"; +			classNum = 4; +			break; +		case 0x196D9: +			roomName = "FCRestrnt"; +			classNum = 4; +			break; +		case 0x39FCB: +			roomName = "Bridge"; +			classNum = 4; +			break; +		case 0x2F86D: +			roomName = "CrtrsCham"; +			classNum = 4; +			break; +		case 0x465FB: +			roomName = "SculpCham"; +			classNum = 4; +			break; +		case 0x3D94B: +			roomName = "BilgeRoom"; +			classNum = 4; +			break; +		case 0x59FAD: +			roomName = "BoWell"; +			classNum = 4; +			break; +		case 0x4D6AF: +			roomName = "Arboretum"; +			classNum = 4; +			break; +		case 0x8A397: +			roomName = "TitRoom"; +			classNum = 4; +			break; +		case 0x79C45: +			roomName = "PromDeck"; +			classNum = 4; +			break; +		case 0xB3D97: +			roomName = "Bar"; +			classNum = 4; +			break; +		case 0xCC971: +			roomName = "EmbLobby"; +			classNum = 4; +			break; +		case 0xF34DB: +			roomName = "MusicRoom"; +			classNum = 4; +			break; +		default: +			roomName = "BadRoom"; +			classNum = 5; +			break; +		} + +		bits = classNum == 5 ? 0x3D94B : _floorBits; +	} else { +		getFloorMsg.execute(this); +		getRoomMsg.execute(this); +		getClassMsg.execute(this); +		getLiftMsg.execute(this); +		if (getFloorMsg._floorNum > 37 || getRoomMsg._roomNum > 18) +			classNum = 5; + +		if (classNum == 5) { +			bits = 0x3D94B; +		} else { +			switch (getClassMsg._classNum) { +			case 1: +				if (getFloorMsg._floorNum >= 2 && getFloorMsg._floorNum <= 18 +					&& getRoomMsg._roomNum >= 1 && getRoomMsg._roomNum <= 3 +					&& getLiftMsg._liftNum >= 1 && getLiftMsg._liftNum <= 4) +					classNum = 1; +				else +					classNum = 5; +				break; + +			case 2: +				if (getFloorMsg._floorNum >= 19 && getFloorMsg._floorNum <= 26 +					&& getRoomMsg._roomNum >= 1 && getRoomMsg._roomNum <= 5 +					&& getLiftMsg._liftNum >= 1 && getLiftMsg._liftNum <= 4) +					classNum = 2; +				else +					classNum = 5; +				break; + +			case 3: +				if (getFloorMsg._floorNum >= 27 && getFloorMsg._floorNum <= 37 +					&& getRoomMsg._roomNum >= 1 && getRoomMsg._roomNum <= 18 +					&& (getLiftMsg._liftNum & 1) == 1 +					&& getLiftMsg._liftNum >= 1 && getLiftMsg._liftNum <= 4) +					classNum = 3; +				else +					classNum = 5; +				break; +			} +		} +		// TODO +	} + +	msg->_classNum = classNum; +	msg->_chevCode = bits; + +	// WORKAROUND: Skipped code from original that was for debugging purposes only  	return true;  } diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index 816c5f5fd6..c146052f10 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -211,7 +211,7 @@ MESSAGE2(CCarryObjectArrivedMsg, CString, strValue, "", int, numValue, 0);  MESSAGE2(CChangeMusicMsg, CString, filename, "", int, flags, 0);  MESSAGE1(CChangeSeasonMsg, CString, season, "Summer");  MESSAGE0(CCheckAllPossibleCodes); -MESSAGE2(CCheckChevCode, int, value1, 0, int, value2, 0); +MESSAGE2(CCheckChevCode, int, classNum, 0, uint, chevCode, 0);  MESSAGE1(CChildDragEndMsg, int, value, 0);  MESSAGE2(CChildDragMoveMsg, int, value1, 0, int, value2, 0);  MESSAGE2(CChildDragStartMsg, int, value1, 0, int, value2, 0); diff --git a/engines/titanic/npcs/parrot_succubus.cpp b/engines/titanic/npcs/parrot_succubus.cpp index 652282bb48..5f67b8f44c 100644 --- a/engines/titanic/npcs/parrot_succubus.cpp +++ b/engines/titanic/npcs/parrot_succubus.cpp @@ -129,6 +129,7 @@ bool CParrotSuccUBus::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {  		CHoseConnectedMsg hoseMsg;  		hoseMsg._value = 0;  		hoseMsg.execute(this); +		return true;  	} else {  		return CSuccUBus::MouseButtonDownMsg(msg);  	} @@ -136,7 +137,7 @@ bool CParrotSuccUBus::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {  bool CParrotSuccUBus::LeaveNodeMsg(CLeaveNodeMsg *msg) {  	if (_field1DC) { -		CGameObject *obj = getHiddenObject(_string3); +		getHiddenObject(_string3);  		if (CHose::_statics->_v2.empty()) {  			playSound("z#51.wav");  			CHoseConnectedMsg hoseMsg;  | 
