[Scummvm-cvs-logs] SF.net SVN: scummvm:[48349] scummvm/trunk/engines/teenagent

megath at users.sourceforge.net megath at users.sourceforge.net
Sun Mar 21 08:38:10 CET 2010


Revision: 48349
          http://scummvm.svn.sourceforge.net/scummvm/?rev=48349&view=rev
Author:   megath
Date:     2010-03-21 07:38:09 +0000 (Sun, 21 Mar 2010)

Log Message:
-----------
-added overlay rendering flag
-fixed music played too late on some scenes

Modified Paths:
--------------
    scummvm/trunk/engines/teenagent/callbacks.cpp
    scummvm/trunk/engines/teenagent/scene.cpp
    scummvm/trunk/engines/teenagent/scene.h
    scummvm/trunk/engines/teenagent/teenagent.cpp
    scummvm/trunk/engines/teenagent/teenagent.h

Modified: scummvm/trunk/engines/teenagent/callbacks.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/callbacks.cpp	2010-03-21 07:13:13 UTC (rev 48348)
+++ scummvm/trunk/engines/teenagent/callbacks.cpp	2010-03-21 07:38:09 UTC (rev 48349)
@@ -289,6 +289,7 @@
 
 			Dialog::show(scene, 0x6117, 0, 813, 0xd1, 0xec, 0, 1);
 			loadScene(6, 230, 184);
+			playMusic(5);
 			Dialog::show(scene, 0x626a, 0, 814, 0xd1, 0xec, 0, 1);
 			playSound(4, 14);
 			playAnimation(815, 0);
@@ -297,7 +298,6 @@
 			Dialog::showMono(scene, 0x62dc, 0, 0xd1, 0);
 
 			SET_FLAG(0xDBDF, 1);
-			playMusic(5);
 		}
 		return true;
 
@@ -1389,8 +1389,8 @@
 	case 0x5502:
 		setOns(0, 0);
 		loadScene(15, 115, 180, 1);
+		playMusic(6);
 		playActorAnimation(568);
-		playMusic(6);
 		return true;
 
 	case 0x5561://Enter lakeside house
@@ -2199,6 +2199,7 @@
 
 	case 0x7f23://Use grenade on captains drawer
 		if (CHECK_FLAG(0xDBDF, 3)) {
+			enableOn(false);
 			playSound(5, 3);
 			playSound(58, 11);
 			playSound(46, 56);
@@ -2212,6 +2213,7 @@
 			moveTo(224, 194, 0, true);
 			displayCutsceneMessage(0x57df, 30423);
 			inventory->remove(0x59);
+			enableOn(true);
 		} else {
 			displayMessage(0x5de2);
 		}
@@ -2439,17 +2441,17 @@
 		SET_FLAG(0xDB9F, 1);
 		return true;
 
-	case 0x84c7:
+	case 0x84c7: //using paddle on boat
 		playSound(20, 9);
 		playActorAnimation(530);
 		loadScene(16, 236, 95, 1);
+		playMusic(9);
 		playActorAnimation(531);
 		playSound(36, 4);
 		playActorAnimation(532);
 		playActorAnimation(533);
 		setOns(0, 9);
 		moveTo(236, 95, 1, true);
-		playMusic(9);
 		return true;
 
 	case 0x8538://Sharpen sickle on well
@@ -2707,11 +2709,11 @@
 			playAnimation(675, 0, true);
 			waitAnimation();
 			loadScene(28, 0, 167, 2);
+			playMusic(10);
 			moveTo(66, 167, 2);
 			displayMessage(0x4a6f);
 			inventory->clear();
 			inventory->add(29);
-			playMusic(10);
 		} else
 			displayMessage(0x4a29);
 		return true;

Modified: scummvm/trunk/engines/teenagent/scene.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/scene.cpp	2010-03-21 07:13:13 UTC (rev 48348)
+++ scummvm/trunk/engines/teenagent/scene.cpp	2010-03-21 07:38:09 UTC (rev 48349)
@@ -204,6 +204,7 @@
 	_system = system;
 
 	_fade_timer = 0;
+	on_enabled = true;
 
 	memset(palette, 0, sizeof(palette));
 
@@ -369,6 +370,7 @@
 void Scene::init(int id, const Common::Point &pos) {
 	debug(0, "init(%d)", id);
 	_id = id;
+	on_enabled = true; //reset on-rendering flag on loading.
 	sounds.clear();
 	for (byte i = 0; i < 4; ++i)
 		custom_animation[i].free();
@@ -444,6 +446,7 @@
 	actor_animation.load(s);
 	actor_animation.loop = loop;
 	actor_animation.ignore = ignore;
+	actor_animation.id = id;
 }
 
 Animation * Scene::getAnimation(byte slot) {
@@ -809,7 +812,8 @@
 		}
 		//removed mark == null. In final scene of chapter 2 mark rendered above table. 
 		//if it'd cause any bugs, add hack here. (_id != 23 && mark == NULL) 
-		if (debug_features.feature[DebugFeatures::kShowOn]) {
+		if (on_enabled && 
+			debug_features.feature[DebugFeatures::kShowOn]) {
 			on.render(surface, actor_animation_position);
 		}
 
@@ -915,9 +919,16 @@
 		switch (current_event.type) {
 
 		case SceneEvent::kSetOn: {
-			byte *ptr = getOns(current_event.scene == 0 ? _id : current_event.scene);
-			debug(0, "on[%u] = %02x", current_event.ons - 1, current_event.color);
-			ptr[current_event.ons - 1] = current_event.color;
+			byte on_id = current_event.ons;
+			if (on_id != 0) {
+				--on_id;
+				byte *ptr = getOns(current_event.scene == 0 ? _id : current_event.scene);
+				debug(0, "on[%u] = %02x", on_id, current_event.color);
+				ptr[on_id] = current_event.color;
+			} else {
+				on_enabled = current_event.color != 0;
+				debug(0, "%s on rendering", on_enabled? "enabling": "disabling");
+			}
 			loadOns();
 			current_event.clear();
 		}

Modified: scummvm/trunk/engines/teenagent/scene.h
===================================================================
--- scummvm/trunk/engines/teenagent/scene.h	2010-03-21 07:13:13 UTC (rev 48348)
+++ scummvm/trunk/engines/teenagent/scene.h	2010-03-21 07:38:09 UTC (rev 48349)
@@ -192,6 +192,7 @@
 	int _id;
 	Graphics::Surface background;
 	SurfaceList on;
+	bool on_enabled;
 	Surface *ons;
 	uint32 ons_count;
 	Animation actor_animation, animation[4], custom_animation[4];

Modified: scummvm/trunk/engines/teenagent/teenagent.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/teenagent.cpp	2010-03-21 07:13:13 UTC (rev 48348)
+++ scummvm/trunk/engines/teenagent/teenagent.cpp	2010-03-21 07:38:09 UTC (rev 48349)
@@ -777,6 +777,13 @@
 	fadeIn();
 }
 
+void TeenAgentEngine::enableOn(bool enable) {
+	SceneEvent event(SceneEvent::kSetOn);
+	event.ons = 0;
+	event.color = enable? 1: 0;
+	scene->push(event);
+}
+
 void TeenAgentEngine::setOns(byte id, byte value, byte scene_id) {
 	SceneEvent event(SceneEvent::kSetOn);
 	event.ons = id + 1;

Modified: scummvm/trunk/engines/teenagent/teenagent.h
===================================================================
--- scummvm/trunk/engines/teenagent/teenagent.h	2010-03-21 07:13:13 UTC (rev 48348)
+++ scummvm/trunk/engines/teenagent/teenagent.h	2010-03-21 07:38:09 UTC (rev 48349)
@@ -94,6 +94,7 @@
 	void playAnimation(uint16 id, byte slot, bool async = false, bool ignore = false, bool loop = false);
 	void loadScene(byte id, const Common::Point &pos, byte o = 0);
 	void loadScene(byte id, uint16 x, uint16 y, byte o = 0);
+	void enableOn(bool enable = true);
 	void setOns(byte id, byte value, byte scene_id = 0);
 	void setLan(byte id, byte value, byte scene_id = 0);
 	void setFlag(uint16 addr, byte value);


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