From 5be9157dce4b6ab479f76ecab4086c0ee75d7958 Mon Sep 17 00:00:00 2001
From: Strangerke
Date: Mon, 28 Apr 2014 22:21:45 +0200
Subject: MADS: Implement scene 389

---
 engines/mads/nebular/nebular_scenes.cpp  |  2 +
 engines/mads/nebular/nebular_scenes3.cpp | 80 ++++++++++++++++++++++++++++++++
 engines/mads/nebular/nebular_scenes3.h   | 17 +++++++
 3 files changed, 99 insertions(+)

diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp
index 77a7a223c9..d3caa19b8a 100644
--- a/engines/mads/nebular/nebular_scenes.cpp
+++ b/engines/mads/nebular/nebular_scenes.cpp
@@ -156,6 +156,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) {
 		return new Scene387(vm);
 	case 388:
 		return new Scene388(vm);
+	case 389:
+		return new Scene389(vm);
 
 	// Scene group #8
 	case 804:
diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp
index 4db80836e8..5d84a3203a 100644
--- a/engines/mads/nebular/nebular_scenes3.cpp
+++ b/engines/mads/nebular/nebular_scenes3.cpp
@@ -5307,5 +5307,85 @@ void Scene388::actions() {
 
 /*------------------------------------------------------------------------*/
 
+void Scene389::setup() {
+	setPlayerSpritesPrefix();
+	setAAName();
+}
+
+void Scene389::enter() {
+	_scene->_userInterface.setup(kInputLimitedSentences);
+	_monsterTime = 0;
+	_circularQuoteId = 0x159;
+
+	if (_globals[kAfterHavoc])
+		_scene->_hotspots.activate(0x304, false);
+	else {
+		_globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('m', -1));
+		_globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 6, 0, 0, 0);
+		warning("TODO: sub71704(1, 88, 177, 19, 17, 0xD, 2, 0xFDFC, 0x3C, 0xF7, 0xF8, 0xF9, 0);");
+	}
+
+	_vm->_palette->setEntry(252, 63, 37, 26);
+	_vm->_palette->setEntry(253, 45, 24, 17);
+	_game._player._visible = false;
+	_game.loadQuoteSet(0xF7, 0xF8, 0xF9, 0x159, 0x15A, 0x15B, 0);
+
+	sceneEntrySound();
+}
+
+void Scene389::step() {
+	warning("TODO: sub7178C()");
+
+	if (_scene->_frameStartTime >= _monsterTime) {
+		warning("sub717B2(20, (sub7176C() << 2) + 1);");
+		_monsterTime = _scene->_frameStartTime + 2;
+	}
+}
+
+void Scene389::actions() {
+	if (_action.isAction(0x2D5, 0x2D4))
+		_scene->_nextSceneId = 313;
+	else if (_action.isAction(VERB_TALKTO, 0x304)) {
+		switch (_game._trigger) {
+		case 0:
+			_game._player._stepEnabled = false;
+			_scene->_kernelMessages.add(Common::Point(160, 136), 0x1110, 32, 1, 120, _game.getQuote(_circularQuoteId));
+			_circularQuoteId++;
+			if (_circularQuoteId > 0x15B)
+				_circularQuoteId = 0x159;
+
+			break;
+
+		case 1:
+			_game._player._stepEnabled = true;
+			break;
+
+		default:
+			break;
+		}
+	} else if (_action.isAction(0xD3, 0x2D3)) {
+		if (_globals[kAfterHavoc]) {
+			if (_game._difficulty != DIFFICULTY_HARD) {
+				if (_game._objects[OBJ_SECURITY_CARD]._roomNumber == 359)
+					_vm->_dialogs->show(0x97FF);
+				else
+					_vm->_dialogs->show(0x9800);
+			} else
+				_vm->_dialogs->show(0x9800);
+		} else
+			_vm->_dialogs->show(0x97FE);
+	} else if (_action.isAction(VERB_OPEN, 0x2D3)) {
+		if (_globals[kAfterHavoc])
+			_vm->_dialogs->show(0x9802);
+		else
+			_vm->_dialogs->show(0x9801);
+	} else
+		return;
+
+	_action._inProgress = false;
+}
+
+/*------------------------------------------------------------------------*/
+
 } // End of namespace Nebular
 } // End of namespace MADS
diff --git a/engines/mads/nebular/nebular_scenes3.h b/engines/mads/nebular/nebular_scenes3.h
index 4de4fc1a2c..d05c5e8980 100644
--- a/engines/mads/nebular/nebular_scenes3.h
+++ b/engines/mads/nebular/nebular_scenes3.h
@@ -514,6 +514,23 @@ public:
 	virtual void postActions() {};
 };
 
+class Scene389: public Scene3xx {
+private:
+	uint32 _monsterTime;
+
+	int _circularQuoteId;
+
+public:
+	Scene389(MADSEngine *vm) : Scene3xx(vm) {}
+
+	virtual void setup();
+	virtual void enter();
+	virtual void step();
+	virtual void preActions() {}
+	virtual void actions();
+	virtual void postActions() {};
+};
+
 } // End of namespace Nebular
 } // End of namespace MADS
 
-- 
cgit v1.2.3