[Scummvm-cvs-logs] SF.net SVN: scummvm:[33162] scummvm/trunk/engines/parallaction

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Mon Jul 21 08:08:34 CEST 2008


Revision: 33162
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33162&view=rev
Author:   peres001
Date:     2008-07-21 06:08:30 +0000 (Mon, 21 Jul 2008)

Log Message:
-----------
Massive refactoring of dialogue code, which is now implemented as a finite state machine. Related code in other files has been updated has well.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/dialogue.cpp
    scummvm/trunk/engines/parallaction/exec_ns.cpp
    scummvm/trunk/engines/parallaction/input.cpp
    scummvm/trunk/engines/parallaction/input.h
    scummvm/trunk/engines/parallaction/parallaction.cpp
    scummvm/trunk/engines/parallaction/parallaction.h
    scummvm/trunk/engines/parallaction/parallaction_br.cpp

Modified: scummvm/trunk/engines/parallaction/dialogue.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/dialogue.cpp	2008-07-21 05:40:34 UTC (rev 33161)
+++ scummvm/trunk/engines/parallaction/dialogue.cpp	2008-07-21 06:08:30 UTC (rev 33162)
@@ -42,13 +42,23 @@
 #define ANSWER_CHARACTER_X			10
 #define ANSWER_CHARACTER_Y			80
 
+
 class DialogueManager {
 
+	enum {
+		RUN_QUESTION,
+		RUN_ANSWER,
+		NEXT_QUESTION,
+		NEXT_ANSWER,
+		DIALOGUE_OVER
+	} _state;
+
 	Parallaction	*_vm;
-	SpeakData		*_data;
 	Dialogue		*_dialogue;
 
 	bool			_askPassword;
+	int				_passwordLen;
+	bool			_passwordChanged;
 
 	bool			isNpc;
 	GfxObj			*_questioner;
@@ -59,98 +69,70 @@
 	uint16			_visAnswers[5];
 	int			_numVisAnswers;
 
+	int			_answerId;
+
+	int		_selection, _oldSelection;
+
+	uint32			_mouseButtons;
+	Common::Point	_mousePos;
+	bool			_isKeyDown;
+	uint16			_downKey;
+
+
 public:
-	DialogueManager(Parallaction *vm, SpeakData *data) : _vm(vm), _data(data) {
-		_dialogue = _data->_dialogue;
-		isNpc = scumm_stricmp(_data->_name, "yourself") && _data->_name[0] != '\0';
-		_questioner = isNpc ? _vm->_disk->loadTalk(_data->_name) : _vm->_char._talk;
-		_answerer = _vm->_char._talk;
-	}
+	DialogueManager(Parallaction *vm, ZonePtr z);
+	~DialogueManager();
 
-	~DialogueManager() {
-		if (isNpc) {
-			delete _questioner;
-		}
+	bool isOver() {
+		return _state == DIALOGUE_OVER;
 	}
-
 	void run();
 
+	ZonePtr			_z;
+	CommandList *_cmdList;
+
 protected:
-	void displayQuestion();
+	bool displayQuestion();
 	bool displayAnswers();
 	bool displayAnswer(uint16 i);
 
-	uint16 getAnswer();
-	int16 selectAnswer();
-	uint16 askPassword();
+	int16 selectAnswer1();
+	int16 selectAnswerN();
+	int16 askPassword();
 	int16 getHoverAnswer(int16 x, int16 y);
 
+	void runQuestion();
+	void runAnswer();
+	void nextQuestion();
+	void nextAnswer();
+
+	bool checkPassword();
+	void resetPassword();
+	void accumPassword(uint16 ascii);
 };
 
-uint16 DialogueManager::askPassword() {
-	debugC(3, kDebugExec, "checkDialoguePassword()");
+DialogueManager::DialogueManager(Parallaction *vm, ZonePtr z) : _vm(vm), _z(z) {
+	_dialogue = _z->u.speak->_dialogue;
+	isNpc = scumm_stricmp(_z->u.speak->_name, "yourself") && _z->u.speak->_name[0] != '\0';
+	_questioner = isNpc ? _vm->_disk->loadTalk(_z->u.speak->_name) : _vm->_char._talk;
+	_answerer = _vm->_char._talk;
 
-	uint16 passwordLen = 0;
-	_password[0] = '\0';
+	_askPassword = false;
+	_q = _dialogue->_questions[0];
 
-	_vm->_balloonMan->setDialogueBalloon(_q->_answers[0]->_text, 1, 3);
-	int id = _vm->_gfx->setItem(_answerer, ANSWER_CHARACTER_X, ANSWER_CHARACTER_Y);
-	_vm->_gfx->setItemFrame(id, 0);
+	_cmdList = 0;
+	_answerId = 0;
 
-	Common::Event e;
-	bool changed = true;	// force first refresh
+	_state = displayQuestion() ? RUN_QUESTION : NEXT_ANSWER;
+}
 
-	while (true) {
-		e.kbd.ascii = 0;
-
-		if (g_system->getEventManager()->pollEvent(e)) {
-			if (e.type == Common::EVENT_QUIT) {
-				_engineFlags |= kEngineQuit;
-				break;
-			}
-
-			if ((e.type == Common::EVENT_KEYDOWN) && isdigit(e.kbd.ascii)) {
-				_password[passwordLen] = e.kbd.ascii;
-				passwordLen++;
-				_password[passwordLen] = '\0';
-				changed = true;
-			}
-		}
-
-		if (changed) {
-			_vm->_balloonMan->setBalloonText(0, _q->_answers[0]->_text, 3);
-			_vm->_gfx->updateScreen();
-			changed = false;
-		}
-
-		if ((passwordLen == MAX_PASSWORD_LENGTH) || (e.kbd.ascii == Common::KEYCODE_RETURN)) {
-
-			if ((!scumm_stricmp(_vm->_char.getBaseName(), _doughName) && !scumm_strnicmp(_password, "1732461", 7)) ||
-			   (!scumm_stricmp(_vm->_char.getBaseName(), _donnaName) && !scumm_strnicmp(_password, "1622", 4)) ||
-			   (!scumm_stricmp(_vm->_char.getBaseName(), _dinoName) && !scumm_strnicmp(_password, "179", 3))) {
-
-				break;
-
-			} else {
-				passwordLen = 0;
-				_password[0] = '\0';
-				changed = true;
-			}
-
-		}
-
-		g_system->delayMillis(20);
-
+DialogueManager::~DialogueManager() {
+	if (isNpc) {
+		delete _questioner;
 	}
-
-	_vm->hideDialogueStuff();
-
-	return 0;
-
+	_z = nullZonePtr;
 }
 
-
-
 bool DialogueManager::displayAnswer(uint16 i) {
 
 	Answer *a = _q->_answers[i];
@@ -183,135 +165,243 @@
 		displayAnswer(i);
 	}
 
+	if (_askPassword) {
+		resetPassword();
+//		_vm->_balloonMan->setDialogueBalloon(_q->_answers[0]->_text, 1, 3);
+		int id = _vm->_gfx->setItem(_answerer, ANSWER_CHARACTER_X, ANSWER_CHARACTER_Y);
+		_vm->_gfx->setItemFrame(id, 0);
+	} else
+	if (_numVisAnswers == 1) {
+		int id = _vm->_gfx->setItem(_answerer, ANSWER_CHARACTER_X, ANSWER_CHARACTER_Y);
+		_vm->_gfx->setItemFrame(id, _q->_answers[0]->_mood & 0xF);
+		_vm->_balloonMan->setBalloonText(0, _q->_answers[_visAnswers[0]]->_text, 0);
+	} else
+	if (_numVisAnswers > 1) {
+		int id = _vm->_gfx->setItem(_answerer, ANSWER_CHARACTER_X, ANSWER_CHARACTER_Y);
+		_vm->_gfx->setItemFrame(id, _q->_answers[_visAnswers[0]]->_mood & 0xF);
+		_oldSelection = -1;
+		_selection = 0;
+	}
+
 	return _numVisAnswers > 0;
 }
 
-void DialogueManager::displayQuestion() {
+bool DialogueManager::displayQuestion() {
+	if (!scumm_stricmp(_q->_text, "NULL")) return false;
 
-	if (!scumm_stricmp(_q->_text, "NULL")) return;
-
 	_vm->_balloonMan->setSingleBalloon(_q->_text, QUESTION_BALLOON_X, QUESTION_BALLOON_Y, _q->_mood & 0x10, 0);
 	int id = _vm->_gfx->setItem(_questioner, QUESTION_CHARACTER_X, QUESTION_CHARACTER_Y);
 	_vm->_gfx->setItemFrame(id, _q->_mood & 0xF);
 
-	_vm->_gfx->updateScreen();
-	_vm->_input->waitUntilLeftClick();
-	_vm->hideDialogueStuff();
+	return true;
+}
 
-	return;
+
+bool DialogueManager::checkPassword() {
+	return ((!scumm_stricmp(_vm->_char.getBaseName(), _doughName) && !scumm_strnicmp(_password, "1732461", 7)) ||
+		   (!scumm_stricmp(_vm->_char.getBaseName(), _donnaName) && !scumm_strnicmp(_password, "1622", 4)) ||
+		   (!scumm_stricmp(_vm->_char.getBaseName(), _dinoName) && !scumm_strnicmp(_password, "179", 3)));
 }
 
-uint16 DialogueManager::getAnswer() {
+void DialogueManager::resetPassword() {
+	_passwordLen = 0;
+	_password[0] = '\0';
+	_passwordChanged = true;
+}
 
-	uint16 answer = 0;
+void DialogueManager::accumPassword(uint16 ascii) {
+	if (!isdigit(ascii)) {
+		return;
+	}
 
-	if (_askPassword == false) {
-		answer = selectAnswer();
-	} else {
-		answer = askPassword();
+	_password[_passwordLen] = ascii;
+	_passwordLen++;
+	_password[_passwordLen] = '\0';
+	_passwordChanged = true;
+}
+
+int16 DialogueManager::askPassword() {
+
+	if (_isKeyDown) {
+		accumPassword(_downKey);
 	}
 
-	debugC(3, kDebugExec, "runDialogue: user selected answer #%i", answer);
+	if (_passwordChanged) {
+		_vm->_balloonMan->setBalloonText(0, _q->_answers[0]->_text, 3);
+		_passwordChanged = false;
+	}
 
-	return answer;
+	if ((_passwordLen == MAX_PASSWORD_LENGTH) || ((_isKeyDown) && (_downKey == Common::KEYCODE_RETURN))) {
+		if (checkPassword()) {
+			return 0;
+		} else {
+			resetPassword();
+		}
+	}
+
+	return -1;
 }
 
-void DialogueManager::run() {
+int16 DialogueManager::selectAnswer1() {
 
-	_askPassword = false;
-	CommandList *cmdlist = NULL;
+	if (_mouseButtons == kMouseLeftUp) {
+		return 0;
+	}
 
-	_q = _dialogue->_questions[0];
-	int16 answer;
+	return -1;
+}
 
-	while (_q) {
+int16 DialogueManager::selectAnswerN() {
 
-		answer = 0;
+	_selection = _vm->_balloonMan->hitTestDialogueBalloon(_mousePos.x, _mousePos.y);
 
-		displayQuestion();
+	if (_selection != _oldSelection) {
+		if (_oldSelection != -1) {
+			_vm->_balloonMan->setBalloonText(_oldSelection, _q->_answers[_visAnswers[_oldSelection]]->_text, 3);
+		}
 
-		if (_engineFlags & kEngineQuit)
-			return;
+		if (_selection != -1) {
+			_vm->_balloonMan->setBalloonText(_selection, _q->_answers[_visAnswers[_selection]]->_text, 0);
+			_vm->_gfx->setItemFrame(0, _q->_answers[_visAnswers[_selection]]->_mood & 0xF);
+		}
+	}
 
-		if (_q->_answers[0] == NULL) break;
+	_oldSelection = _selection;
 
-		if (scumm_stricmp(_q->_answers[0]->_text, "NULL")) {
-			if (!displayAnswers()) break;
-			answer = getAnswer();
+	if ((_mouseButtons == kMouseLeftUp) && (_selection != -1)) {
+		return _visAnswers[_selection];
+	}
 
-			if (_engineFlags & kEngineQuit)
-				return;
+	return -1;
+}
 
-			cmdlist = &_q->_answers[answer]->_commands;
-		}
+void DialogueManager::runQuestion() {
+	debugC(9, kDebugDialogue, "runQuestion\n");
 
-		_q = _q->_answers[answer]->_following._question;
+	if (_mouseButtons == kMouseLeftUp) {
+		_vm->hideDialogueStuff();
+		_state = NEXT_ANSWER;
 	}
 
-	if (cmdlist)
-		_vm->_cmdExec->run(*cmdlist);
+}
 
+
+void DialogueManager::nextAnswer() {
+	debugC(9, kDebugDialogue, "nextAnswer\n");
+
+	if (_q->_answers[0] == NULL) {
+		_state = DIALOGUE_OVER;
+		return;
+	}
+
+	if (!scumm_stricmp(_q->_answers[0]->_text, "NULL")) {
+		_answerId = 0;
+		_state = NEXT_QUESTION;
+		return;
+	}
+
+	_state = displayAnswers() ? RUN_ANSWER : DIALOGUE_OVER;
 }
 
-int16 DialogueManager::selectAnswer() {
+void DialogueManager::runAnswer() {
+	debugC(9, kDebugDialogue, "runAnswer\n");
 
-	int16 numAvailableAnswers = _numVisAnswers;
+	if (_askPassword) {
+		_answerId = askPassword();
+	} else
+	if (_numVisAnswers == 1) {
+		_answerId = selectAnswer1();
+	} else {
+		_answerId = selectAnswerN();
+	}
 
-	int id = _vm->_gfx->setItem(_answerer, ANSWER_CHARACTER_X, ANSWER_CHARACTER_Y);
-	_vm->_gfx->setItemFrame(id, _q->_answers[0]->_mood & 0xF);
-
-	if (numAvailableAnswers == 1) {
-		_vm->_balloonMan->setBalloonText(0, _q->_answers[0]->_text, 0);
-		_vm->_input->waitUntilLeftClick();
+	if (_answerId != -1) {
+		_cmdList = &_q->_answers[_answerId]->_commands;
 		_vm->hideDialogueStuff();
-		return 0;
+		_state = NEXT_QUESTION;
 	}
+}
 
-	int oldSelection = -1;
-	int selection = 0;
+void DialogueManager::nextQuestion() {
+	debugC(9, kDebugDialogue, "nextQuestion\n");
 
-	uint32 event;
-	Common::Point p;
-	while ((_engineFlags & kEngineQuit) == 0) {
+	_q = _q->_answers[_answerId]->_following._question;
+	if (_q == 0) {
+		_state = DIALOGUE_OVER;
+	} else {
+		_state = displayQuestion() ? RUN_QUESTION : NEXT_ANSWER;
+	}
+}
 
-		_vm->_input->readInput();
-		_vm->_input->getCursorPos(p);
-		event = _vm->_input->getLastButtonEvent();
-		selection = _vm->_balloonMan->hitTestDialogueBalloon(p.x, p.y);
 
-		if (selection != oldSelection) {
-			if (oldSelection != -1) {
-				_vm->_balloonMan->setBalloonText(oldSelection, _q->_answers[_visAnswers[oldSelection]]->_text, 3);
-			}
+void DialogueManager::run() {
 
-			if (selection != -1) {
-				_vm->_balloonMan->setBalloonText(selection, _q->_answers[_visAnswers[selection]]->_text, 0);
-				_vm->_gfx->setItemFrame(0, _q->_answers[_visAnswers[selection]]->_mood & 0xF);
-			}
-		}
+	// cache event data
+	_mouseButtons = _vm->_input->getLastButtonEvent();
+	_vm->_input->getCursorPos(_mousePos);
+	_isKeyDown = _vm->_input->getLastKeyDown(_downKey);
 
-		if ((selection != -1) && (event == kMouseLeftUp)) {
-			break;
+	switch (_state) {
+	case RUN_QUESTION:
+		runQuestion();
+		break;
+
+	case NEXT_ANSWER:
+		nextAnswer();
+		break;
+
+	case NEXT_QUESTION:
+		nextQuestion();
+		break;
+
+	case RUN_ANSWER:
+		runAnswer();
+		break;
+
+	case DIALOGUE_OVER:
+		if (_cmdList) {
+			_vm->_cmdExec->run(*_cmdList);
 		}
+		break;
 
-		_vm->_gfx->updateScreen();
-		g_system->delayMillis(20);
+	default:
+		error("unknown state in DialogueManager");
 
-		oldSelection = selection;
 	}
 
-	_vm->hideDialogueStuff();
+}
 
-	return _visAnswers[selection];
+void Parallaction::enterDialogueMode(ZonePtr z) {
+	debugC(1, kDebugDialogue, "Parallaction::enterDialogueMode(%s)", z->u.speak->_name);
+	_dialogueMan = new DialogueManager(this, z);
+	_input->_inputMode = Input::kInputModeDialogue;
 }
 
+void Parallaction::exitDialogueMode() {
+	debugC(1, kDebugDialogue, "Parallaction::exitDialogueMode()");
+	_input->_inputMode = Input::kInputModeGame;
 
-void Parallaction::runDialogue(SpeakData *data) {
-	debugC(1, kDebugExec, "runDialogue: starting dialogue '%s'", data->_name);
+	// The current instance of _dialogueMan must be destroyed before the zone commands
+	// are executed, because they may create another instance of _dialogueMan that
+	// overwrite the current one. This would cause headaches (and it did, actually).
+	ZonePtr z = _dialogueMan->_z;
+	delete _dialogueMan;
+	_dialogueMan = 0;
 
-	DialogueManager man(this, data);
-	man.run();
+	_cmdExec->run(z->_commands, z);
+}
 
+void Parallaction::runDialogueFrame() {
+	if (_input->_inputMode != Input::kInputModeDialogue) {
+		return;
+	}
+
+	_dialogueMan->run();
+
+	if (_dialogueMan->isOver()) {
+		exitDialogueMode();
+	}
+
 	return;
 }
 

Modified: scummvm/trunk/engines/parallaction/exec_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/exec_ns.cpp	2008-07-21 05:40:34 UTC (rev 33161)
+++ scummvm/trunk/engines/parallaction/exec_ns.cpp	2008-07-21 06:08:30 UTC (rev 33162)
@@ -224,7 +224,11 @@
 
 
 DECLARE_COMMAND_OPCODE(speak) {
-	_vm->_activeZone = _ctxt.cmd->u._zone;
+	if ((_ctxt.cmd->u._zone->_type & 0xFFFF) == kZoneSpeak) {
+		_vm->enterDialogueMode(_ctxt.cmd->u._zone);
+	} else {
+		_vm->_activeZone = _ctxt.cmd->u._zone;
+	}
 }
 
 
@@ -321,6 +325,7 @@
 
 
 void Parallaction_ns::drawAnimations() {
+	debugC(9, kDebugExec, "Parallaction_ns::drawAnimations()\n");
 
 	uint16 layer = 0;
 
@@ -361,6 +366,8 @@
 		}
 	}
 
+	debugC(9, kDebugExec, "Parallaction_ns::drawAnimations done()\n");
+
 	return;
 }
 
@@ -416,7 +423,6 @@
 	return;
 }
 
-
 void CommandExec::run(CommandList& list, ZonePtr z) {
 	if (list.size() == 0) {
 		debugC(3, kDebugExec, "runCommands: nothing to do");
@@ -537,11 +543,8 @@
 		break;
 
 	case kZoneSpeak:
-		runDialogue(z->u.speak);
-		if (_engineFlags & kEngineQuit)
-			return 0;
-		break;
-
+		enterDialogueMode(z);
+		return 0;
 	}
 
 	debugC(3, kDebugExec, "runZone completed");

Modified: scummvm/trunk/engines/parallaction/input.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/input.cpp	2008-07-21 05:40:34 UTC (rev 33161)
+++ scummvm/trunk/engines/parallaction/input.cpp	2008-07-21 06:08:30 UTC (rev 33162)
@@ -42,12 +42,14 @@
 	uint16 KeyDown = 0;
 
 	_mouseButtons = kMouseNone;
+	_lastKeyDownAscii = -1;
 
 	Common::EventManager *eventMan = _vm->_system->getEventManager();
 	while (eventMan->pollEvent(e)) {
 
 		switch (e.type) {
 		case Common::EVENT_KEYDOWN:
+			_lastKeyDownAscii = e.kbd.ascii;
 			if (e.kbd.flags == Common::KBD_CTRL && e.kbd.keycode == 'd')
 				_vm->_debugger->attach();
 			if (_vm->getFeatures() & GF_DEMO) break;
@@ -97,6 +99,11 @@
 
 }
 
+bool Input::getLastKeyDown(uint16 &ascii) {
+	ascii = _lastKeyDownAscii;
+	return (_lastKeyDownAscii != -1);
+}
+
 // FIXME: see comment for readInput()
 void Input::waitForButtonEvent(uint32 buttonEventMask, int32 timeout) {
 
@@ -192,6 +199,10 @@
 	case kInputModeGame:
 		updateGameInput();
 		break;
+
+	case kInputModeDialogue:
+		readInput();
+		break;
 	}
 
 	return &_inputData;

Modified: scummvm/trunk/engines/parallaction/input.h
===================================================================
--- scummvm/trunk/engines/parallaction/input.h	2008-07-21 05:40:34 UTC (rev 33161)
+++ scummvm/trunk/engines/parallaction/input.h	2008-07-21 06:08:30 UTC (rev 33162)
@@ -66,6 +66,7 @@
 
 	Common::Point	_mousePos;
 	uint16	_mouseButtons;
+	int32	_lastKeyDownAscii;
 
 	bool		_mouseHidden;
 	ZonePtr			_hoverZone;
@@ -73,7 +74,8 @@
 public:
 	enum {
 		kInputModeGame = 0,
-		kInputModeComment = 1
+		kInputModeComment = 1,
+		kInputModeDialogue = 2
 	};
 
 
@@ -102,6 +104,7 @@
 	void 	waitUntilLeftClick();
 	void	waitForButtonEvent(uint32 buttonEventMask, int32 timeout = -1);
 	uint32	getLastButtonEvent() { return _mouseButtons; }
+	bool  	getLastKeyDown(uint16 &ascii);
 
 	void stopHovering() {
 		_hoverZone = nullZonePtr;

Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp	2008-07-21 05:40:34 UTC (rev 33161)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp	2008-07-21 06:08:30 UTC (rev 33162)
@@ -161,7 +161,12 @@
 }
 
 
+void Parallaction::hideDialogueStuff() {
+	_gfx->freeItems();
+	_balloonMan->freeBalloons();
+}
 
+
 void Parallaction::freeCharacter() {
 	debugC(1, kDebugExec, "freeCharacter()");
 
@@ -363,25 +368,29 @@
 void Parallaction::runGame() {
 
 	InputData *data = _input->updateInput();
-	if (data->_event != kEvNone) {
-		processInput(data);
-	}
-
 	if (_engineFlags & kEngineQuit)
 		return;
 
-	runPendingZones();
+	if (_input->_inputMode == Input::kInputModeDialogue) {
+		runDialogueFrame();
+	} else {
+		if (data->_event != kEvNone) {
+			processInput(data);
+		}
 
-	if (_engineFlags & kEngineQuit)
-		return;
+		if (_engineFlags & kEngineQuit)
+			return;
 
-	if (_engineFlags & kEngineChangeLocation) {
-		changeLocation(_location._name);
+		runPendingZones();
+
+		if (_engineFlags & kEngineQuit)
+			return;
+
+		if (_engineFlags & kEngineChangeLocation) {
+			changeLocation(_location._name);
+		}
 	}
 
-	if (_engineFlags & kEngineQuit)
-		return;
-
 	_gfx->beginFrame();
 
 	if (_input->_inputMode == Input::kInputModeGame) {
@@ -396,7 +405,6 @@
 
 	// change this to endFrame?
 	updateView();
-
 }
 
 
@@ -659,6 +667,7 @@
 }
 
 void Parallaction::scheduleLocationSwitch(const char *location) {
+	debugC(9, kDebugExec, "scheduleLocationSwitch(%s)\n", location);
 	strcpy(_location._name, location);
 	_engineFlags |= kEngineChangeLocation;
 }

Modified: scummvm/trunk/engines/parallaction/parallaction.h
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.h	2008-07-21 05:40:34 UTC (rev 33161)
+++ scummvm/trunk/engines/parallaction/parallaction.h	2008-07-21 06:08:30 UTC (rev 33162)
@@ -165,6 +165,7 @@
 class Gfx;
 class SoundMan;
 class Input;
+class DialogueManager;
 
 struct Location {
 
@@ -275,8 +276,6 @@
 	uint16		runZone(ZonePtr z);
 	void		freeZones();
 
-	void		runDialogue(SpeakData*);
-
 	AnimationPtr findAnimation(const char *name);
 	void		freeAnimations();
 
@@ -419,10 +418,11 @@
 
 	void setupBalloonManager();
 
-	void hideDialogueStuff() {
-		_gfx->freeItems();
-		_balloonMan->freeBalloons();
-	}
+	void hideDialogueStuff();
+	DialogueManager	*_dialogueMan;
+	void enterDialogueMode(ZonePtr z);
+	void exitDialogueMode();
+	void runDialogueFrame();
 
 };
 

Modified: scummvm/trunk/engines/parallaction/parallaction_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction_br.cpp	2008-07-21 05:40:34 UTC (rev 33161)
+++ scummvm/trunk/engines/parallaction/parallaction_br.cpp	2008-07-21 06:08:30 UTC (rev 33162)
@@ -212,13 +212,21 @@
 	if (_activeZone) {
 		z = _activeZone;	// speak Zone or sound
 		_activeZone = nullZonePtr;
-		runZone(z);			// FIXME: BRA doesn't handle sound yet
+		if ((z->_type & 0xFFFF) == kZoneSpeak) {
+			enterDialogueMode(z);
+		} else {
+			runZone(z);			// FIXME: BRA doesn't handle sound yet
+		}
 	}
 
 	if (_activeZone2) {
 		z = _activeZone2;	// speak Zone or sound
 		_activeZone2 = nullZonePtr;
-		runZone(z);
+		if ((z->_type & 0xFFFF) == kZoneSpeak) {
+			enterDialogueMode(z);
+		} else {
+			runZone(z);			// FIXME: BRA doesn't handle sound yet
+		}
 	}
 }
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list