diff options
| -rw-r--r-- | engines/mohawk/cstime_cases.cpp | 185 | ||||
| -rw-r--r-- | engines/mohawk/cstime_cases.h | 3 | 
2 files changed, 183 insertions, 5 deletions
| diff --git a/engines/mohawk/cstime_cases.cpp b/engines/mohawk/cstime_cases.cpp index 746196e120..4e36dca051 100644 --- a/engines/mohawk/cstime_cases.cpp +++ b/engines/mohawk/cstime_cases.cpp @@ -149,13 +149,128 @@ void CSTimeCase1::handleConditionalEvent(const CSTimeEvent &event) {  		break;  	case 2: -		// FIXME: Leaving the mummy-preparing room? -		error("cond event 2"); +		// Leaving the dark tomb. +		if (!_vm->getInterface()->getCarmenNote()->havePiece(1)) { +			// Should probably get that note. +			_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventCharStartFlapping, 0, 16356)); +		} else { +			bool doAfter = true; +			if (_vm->_haveInvItem[1]) { +				// Still have the unlit torch. +				_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventCharStartFlapping, 1, 14553)); +				_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventSetInsertBefore, 0, 0xffff)); +				_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventCharStartFlapping, getCurrScene()->getHelperId(), 14356)); +			} else if (_vm->_caseVariable[4]) { +				// Let's start the mummy-making again! +				_vm->_caseVariable[4] = 0; +				_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventCharStartFlapping, 1, 14565)); +				_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventSetInsertBefore, 0, 0xffff)); +			} else if (_vm->_caseVariable[2] && !_vm->_caseVariable[6]) { +				// One-time remark after we saw the hieroglyphs. +				_vm->_caseVariable[6] = 1; +				_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventCharStartFlapping, getCurrScene()->getHelperId(), 14355)); +				_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventCharStartFlapping, 1, 14563)); +				_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventSetInsertBefore, 0, 0xffff)); +			} else +				doAfter = false; + +			if (doAfter) { +				_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventInitScene, 0xffff, 0xffff)); +				_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventCharSetupRestPos, 1, 0xffff)); +				_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventSetInsertBefore, 0, 0xffff)); +			} + +			// Move back to the main room. +			_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventNewScene, 0xffff, 3)); +		}  		break;  	case 3: -		// FIXME: Body sequence stuff. -		error("cond event 3"); +		// Body sequence logic. +		if (!_vm->_caseVariable[2]) { +			// We haven't seen the hieroglyphs yet. No guessing! +			_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventCharStartFlapping, getCurrScene()->getHelperId(), 14354)); +			break; +		} + +		switch (event.param1) { +		case 1: +			// Second part. +			if (_vm->_caseVariable[3] == 1) { +				_vm->_caseVariable[3] = 2; +				// Yes, that was the right thing. +				_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventCharStartFlapping, getCurrScene()->getHelperId(), 14361)); +				_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventCharStartFlapping, 1, 14555)); +				_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventSetInsertBefore, 0, 0xffff)); +				// Update the features. +				_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventAddFeature, 0xffff, 8)); +				_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventAddFeature, 0xffff, event.param1)); +				_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventCharPlayNIS, 2, 1)); +				_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventDisableFeature, 2, 6)); +			} else if (_vm->_caseVariable[3] == 2) { +				// We've already done that part! +				_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventCharStartFlapping, getCurrScene()->getHelperId(), 14357)); +				_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventAddFeature, 0xffff, event.param1)); +			} else { +				incorrectBodySequence(4, 14559, event.param1); +			} +			break; + +		case 2: +			// Third/final part. +			if (_vm->_caseVariable[3] == 2) { +				_vm->_caseVariable[1] = 1; +				// Move to the final room (we can't get here without having all the notes so far). +				_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventNewScene, 0xffff, 5)); +				// Yes, that was the right thing. We'll move onward now. +				_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventCharStartFlapping, 1, 14558)); +				_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventSetInsertBefore, 0, 0xffff)); +				_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventCharStartFlapping, 1, 14556)); +				_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventSetInsertBefore, 0, 0xffff)); +				// Update the features. +				_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventAddFeature, 0xffff, 9)); +				_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventAddFeature, 0xffff, event.param1)); +			} else { +				incorrectBodySequence(9, 14560, event.param1); +			} +			break; + +		case 3: +			// First part. +			if (_vm->_caseVariable[3]) { +				// We've already done that part! +				_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventCharStartFlapping, getCurrScene()->getHelperId(), 14357)); +				_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventAddFeature, 0xffff, event.param1)); +			} else { +				_vm->_caseVariable[3] = 1; +				// Yes, that was the right thing. +				_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventCharStartFlapping, getCurrScene()->getHelperId(), 14360)); +				_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventCharStartFlapping, 1, 14554)); +				_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventSetInsertBefore, 0, 0xffff)); +				// Update the features. +				_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventAddFeature, 0xffff, event.param1)); +				_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventAddFeature, 0xffff, 7)); +				_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventCharPlayNIS, 2, 0)); +				_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventDisableFeature, 2, 6)); +			} +			break; + +		case 4: +			if (_vm->_caseVariable[3] == 2) +				incorrectBodySequence(5, 14561, event.param1); +			else +				incorrectBodySequence(2, 14561, event.param1); +			break; + +		case 5: +			if (_vm->_caseVariable[3] == 2) +				incorrectBodySequence(6, 14562, event.param1); +			else +				incorrectBodySequence(3, 14562, event.param1); +			break; +		} + +		_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventDisableFeature, 0xffff, event.param1));  		break;  	case 4: @@ -194,7 +309,7 @@ void CSTimeCase1::handleConditionalEvent(const CSTimeEvent &event) {  	case 5:  		// We're ready to shove off! -		_vm->addEvent(CSTimeEvent(kCSTimeEventCharStartFlapping, getCurrScene()->getHelperId(), 10356)); +		_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventCharStartFlapping, getCurrScene()->getHelperId(), 10356));  		break;  	case 6: @@ -238,4 +353,64 @@ void CSTimeCase1::handleConditionalEvent(const CSTimeEvent &event) {  	}  } +void CSTimeCase1::incorrectBodySequence(uint16 stage, uint16 speech, uint16 feature) { +	// (This adds events backwards, so read from the bottom up.) + +	// You did it wrong! Set the case variable for leaving the dark tomb, and get sent there. +	_vm->_caseVariable[4] = 1; +	_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventNewScene, 0xffff, 4)); + +	CSTimeEvent event; +	event.type = kCSTimeEventCharStartFlapping; +	event.param1 = getCurrScene()->getHelperId(); +	if (!_vm->_caseVariable[5]) { +		// The first time, you get a nice "let's have another look" suggestion. +		event.param2 = 14353; +		_vm->_caseVariable[5] = 1; +	} else if (_vm->_rnd->getRandomBit()) { +		// Randomly repeat that suggestion... +		event.param2 = 14353; +	} else { +		// Or else something a little grumpier. +		event.param2 = 14358 + _vm->_rnd->getRandomBit(); +	} +	_vm->insertEventAtFront(event); + +	// "What a mess!" +	_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventCharStartFlapping, 1, 14557)); +	_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventSetInsertBefore, 0, 0xffff)); +	_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventCharPlayNIS, 1, 1)); +	_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventSetInsertBefore, 0, 0xffff)); + +	// Enable the head priest(?!). +	_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventCharSetState, 1, 1)); + +	// Explain what went wrong. +	_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventCharStartFlapping, 1, speech)); +	_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventSetInsertBefore, 0, 0xffff)); +	_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventCharPlayNIS, 1, 0)); + +	// Reset the features, with an animation if necessary. +	if (stage == 9) { +		_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventAddFeature, 0xffff, 9)); +		_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventAddFeature, 0xffff, feature)); +	} else { +		_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventAddFeature, 0xffff, stage + 8)); +		_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventAddFeature, 0xffff, feature)); +		_vm->insertEventAtFront(CSTimeEvent(kCSTimeEventCharPlayNIS, 2, 1)); +		event.type = kCSTimeEventDisableFeature; +		event.param1 = 2; +		if (_vm->_caseVariable[3] == 0) +			event.param2 = 6; +		else if (_vm->_caseVariable[3] == 1) +			event.param2 = 7; +		else +			event.param2 = 8; +		_vm->insertEventAtFront(event); +	} + +	// And so, we're back to the beginning of the body sequence. +	_vm->_caseVariable[3] = 0; +} +  } // End of namespace Mohawk diff --git a/engines/mohawk/cstime_cases.h b/engines/mohawk/cstime_cases.h index 5f6791fdc1..6f7630648e 100644 --- a/engines/mohawk/cstime_cases.h +++ b/engines/mohawk/cstime_cases.h @@ -40,6 +40,9 @@ public:  	bool checkObjectCondition(uint16 objectId);  	void selectHelpStrings();  	void handleConditionalEvent(const CSTimeEvent &event); + +protected: +	void incorrectBodySequence(uint16 stage, uint16 speech, uint16 feature);  };  } // End of namespace Mohawk | 
