diff options
| -rw-r--r-- | engines/prince/prince.cpp | 44 | ||||
| -rw-r--r-- | engines/prince/prince.h | 1 | ||||
| -rw-r--r-- | engines/prince/script.cpp | 40 | ||||
| -rw-r--r-- | engines/prince/script.h | 2 | 
4 files changed, 44 insertions, 43 deletions
| diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp index 5b0cea3066..37c7ce46f6 100644 --- a/engines/prince/prince.cpp +++ b/engines/prince/prince.cpp @@ -780,11 +780,10 @@ void PrinceEngine::keyHandler(Common::Event event) {  		debugEngine("RIGHT");  		break;  	case Common::KEYCODE_1: -		//if(_mainHero->_state > 0) { -		//	_mainHero->_state--; -		//} -		//debugEngine("%d", _mainHero->_state); -		testDialog(); +		if(_mainHero->_state > 0) { +			_mainHero->_state--; +		} +		debugEngine("%d", _mainHero->_state);  		break;  	case Common::KEYCODE_2:  		_mainHero->_state++; @@ -2356,7 +2355,7 @@ void PrinceEngine::talkHero(int slot, const char *s) {  void PrinceEngine::doTalkAnim(int animNumber, int slot, AnimType animType) {  	Text &text = _textSlots[slot]; -	int lines = calcText((const char *)_interpreter->getGlobalString()); +	int lines = calcText((const char *)_interpreter->getString());  	int time = lines * 30;  	if (animType == kNormalAnimation) {  		Anim &normAnim = _normAnimList[animNumber]; @@ -2387,41 +2386,10 @@ void PrinceEngine::doTalkAnim(int animNumber, int slot, AnimType animType) {  		error("doTalkAnim() - wrong animType: %d", animType);  	}  	text._time = time; -	text._str = (const char *)_interpreter->getGlobalString(); +	text._str = (const char *)_interpreter->getString();  	_interpreter->increaseString();  } -// Test -void PrinceEngine::testDialog() { -	Common::Array<DialogLine> tempDialogBox; -	DialogLine tempDialogLine; - -	int dialogBoxSize = 6; - -	// dialBox 0 create: -	for (int i = 0; i < dialogBoxSize; i++) { -		tempDialogLine._nr = i; -		tempDialogLine._line = ""; -		tempDialogBox.push_back(tempDialogLine); -	} -	tempDialogBox[0]._line = "Co to za miejsce?"; -	tempDialogBox[1]._line = "Prosze, musi mi pan pomoc wydostac sie stad!"; -	tempDialogBox[2]._line = "Sam Adanor Wszobrody odmowil mi trzydziestego\n""siodmego kubeczka krasnoludzkiego spirytusu."; -	tempDialogBox[3]._line = "A co do twoich czarodziejskich sztuczek, to\n""jak mowi stare przyslowie, nie chwal sie\n""dokonaniami dnia wczorajszego..."; -	tempDialogBox[4]._line = "Tu chyba nie jest zbyt bezpiecznie, prawda?"; -	tempDialogBox[5]._line = "Nie chce przeszkadzac."; - -	_dialogBoxList.push_back(tempDialogBox); - -	//dialogBox 0 draw: -	createDialogBox(_dialogBoxList[0]); -	if (_dialogBoxList[0].size() != 0) { -		changeCursor(1); -		runDialog(_dialogBoxList[0]); -		changeCursor(0); -	} -} -  void PrinceEngine::freeNormAnim(int slot) {  	_normAnimList[slot]._state = 1;  	delete _normAnimList[slot]._animData; diff --git a/engines/prince/prince.h b/engines/prince/prince.h index 54beda2e69..d59e62a60e 100644 --- a/engines/prince/prince.h +++ b/engines/prince/prince.h @@ -410,7 +410,6 @@ public:  	void runDialog(Common::Array<DialogLine> &dialogData);  	void talkHero(int slot, const char *s);  	void doTalkAnim(int animNumber, int slot, AnimType animType); -	void testDialog();  	int testAnimNr;  	int testAnimFrame; diff --git a/engines/prince/script.cpp b/engines/prince/script.cpp index 2c4d8b66c2..d4fa216d7d 100644 --- a/engines/prince/script.cpp +++ b/engines/prince/script.cpp @@ -522,7 +522,7 @@ void Interpreter::setCurrentString(uint32 value) {  	_currentString = value;  } -byte *Interpreter::getGlobalString() { +byte *Interpreter::getString() {  	return _string;  } @@ -1370,7 +1370,6 @@ void Interpreter::O_INITDIALOG() {  		stringESI += 2;  		_string = stringEBP + adressOfFirstSequence; -		// like this?  		for (uint i = 0; i < _vm->_dialogBoxList.size(); i++) {  			_vm->_dialogBoxList[i].clear();  		} @@ -1420,6 +1419,41 @@ void Interpreter::O_INITDIALOG() {  			dialogOptAddr[edi] = eax;  			edi++;  		} + +		int i = 0; +		Common::Array<DialogLine> tempDialogBox; +		while (dialogBoxAddr[i] != 0) { +			tempDialogBox.clear(); +			byte *boxAddr = dialogBoxAddr[i]; + +			byte *stream = boxAddr; +			int streamSize = 0; +			while (*stream != 0xFF) { +				stream++; +				streamSize++; +			} +			streamSize++; +			//int dialogDataValueEDI = (int)READ_UINT32(dialogData); +			byte c; +			int sentenceNumber; +			DialogLine tempDialogLine; +			Common::MemoryReadStream dialogStream(boxAddr, streamSize); +			while ((sentenceNumber = dialogStream.readSByte()) != -1) { +				tempDialogLine._line.clear(); +				//bt edi, eax +				//jc skip_zdanko +				// skip_sentence - TODO +				tempDialogLine._nr = sentenceNumber; + +				while ((c = dialogStream.readByte())) { +					tempDialogLine._line += c; +				} +				tempDialogBox.push_back(tempDialogLine); +			} +			_vm->_dialogBoxList.push_back(tempDialogBox); +			i++; +		} +  		//opt_done  		int freeASlot = 0;  		int freeBSlot = 0; @@ -1430,7 +1464,7 @@ void Interpreter::O_INITDIALOG() {  		//check  		for (int i = 31; i >= 0; i--) {  			if (dialogOptAddr[i] != 0) { -				// or i++ before break here? +				i++;  				debug("%s", (char *)dialogOptAddr[i]);  				freeHSlot = i;  				_flags->setFlagValue(Flags::VOICE_H_LINE, i); diff --git a/engines/prince/script.h b/engines/prince/script.h index 25c71bf6a1..a822b44ccb 100644 --- a/engines/prince/script.h +++ b/engines/prince/script.h @@ -185,7 +185,7 @@ public:  	uint32 getCurrentString();  	void setCurrentString(uint32 value); -	byte *getGlobalString(); +	byte *getString();  	void increaseString(); | 
