aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Menshakov2010-03-21 07:38:09 +0000
committerVladimir Menshakov2010-03-21 07:38:09 +0000
commit76ef5d4aea87d07ccf1fd4fbba33af2aae9c42e8 (patch)
tree92da5a8375ebf8a8ec3277570bdefb60f5d49830
parentee2215eaeec86cfe55c28ddc438d8f1d55a1add0 (diff)
downloadscummvm-rg350-76ef5d4aea87d07ccf1fd4fbba33af2aae9c42e8.tar.gz
scummvm-rg350-76ef5d4aea87d07ccf1fd4fbba33af2aae9c42e8.tar.bz2
scummvm-rg350-76ef5d4aea87d07ccf1fd4fbba33af2aae9c42e8.zip
-added overlay rendering flag
-fixed music played too late on some scenes svn-id: r48349
-rw-r--r--engines/teenagent/callbacks.cpp12
-rw-r--r--engines/teenagent/scene.cpp19
-rw-r--r--engines/teenagent/scene.h1
-rw-r--r--engines/teenagent/teenagent.cpp7
-rw-r--r--engines/teenagent/teenagent.h1
5 files changed, 31 insertions, 9 deletions
diff --git a/engines/teenagent/callbacks.cpp b/engines/teenagent/callbacks.cpp
index c56489b24f..b108b2c96d 100644
--- a/engines/teenagent/callbacks.cpp
+++ b/engines/teenagent/callbacks.cpp
@@ -289,6 +289,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
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 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
Dialog::showMono(scene, 0x62dc, 0, 0xd1, 0);
SET_FLAG(0xDBDF, 1);
- playMusic(5);
}
return true;
@@ -1389,8 +1389,8 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
case 0x5502:
setOns(0, 0);
loadScene(15, 115, 180, 1);
- playActorAnimation(568);
playMusic(6);
+ playActorAnimation(568);
return true;
case 0x5561://Enter lakeside house
@@ -2199,6 +2199,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
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 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
moveTo(224, 194, 0, true);
displayCutsceneMessage(0x57df, 30423);
inventory->remove(0x59);
+ enableOn(true);
} else {
displayMessage(0x5de2);
}
@@ -2439,17 +2441,17 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
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 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
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;
diff --git a/engines/teenagent/scene.cpp b/engines/teenagent/scene.cpp
index b406bcc00a..477f5dca89 100644
--- a/engines/teenagent/scene.cpp
+++ b/engines/teenagent/scene.cpp
@@ -204,6 +204,7 @@ void Scene::init(TeenAgentEngine *engine, OSystem *system) {
_system = system;
_fade_timer = 0;
+ on_enabled = true;
memset(palette, 0, sizeof(palette));
@@ -369,6 +370,7 @@ void Scene::loadLans() {
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 @@ void Scene::playActorAnimation(uint id, bool loop, bool ignore) {
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 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 delta) {
}
//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 @@ bool Scene::processEventQueue() {
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();
}
diff --git a/engines/teenagent/scene.h b/engines/teenagent/scene.h
index 92e5e05c04..28d0db6a7b 100644
--- a/engines/teenagent/scene.h
+++ b/engines/teenagent/scene.h
@@ -192,6 +192,7 @@ private:
int _id;
Graphics::Surface background;
SurfaceList on;
+ bool on_enabled;
Surface *ons;
uint32 ons_count;
Animation actor_animation, animation[4], custom_animation[4];
diff --git a/engines/teenagent/teenagent.cpp b/engines/teenagent/teenagent.cpp
index f2c765d4d9..657d76ef7c 100644
--- a/engines/teenagent/teenagent.cpp
+++ b/engines/teenagent/teenagent.cpp
@@ -777,6 +777,13 @@ void TeenAgentEngine::loadScene(byte id, uint16 x, uint16 y, byte o) {
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;
diff --git a/engines/teenagent/teenagent.h b/engines/teenagent/teenagent.h
index f9dc590b54..225439907f 100644
--- a/engines/teenagent/teenagent.h
+++ b/engines/teenagent/teenagent.h
@@ -94,6 +94,7 @@ public:
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);