diff options
author | Vladimir Menshakov | 2009-11-12 10:32:29 +0000 |
---|---|---|
committer | Vladimir Menshakov | 2009-11-12 10:32:29 +0000 |
commit | ec235d7463c69784fb2de1cdf915279f37a714e1 (patch) | |
tree | 654a934d1b7c5a43c19ce639dab296aff14050ee | |
parent | 94f5c0a2f85a181c6b42f2851270b46de603e1cb (diff) | |
download | scummvm-rg350-ec235d7463c69784fb2de1cdf915279f37a714e1.tar.gz scummvm-rg350-ec235d7463c69784fb2de1cdf915279f37a714e1.tar.bz2 scummvm-rg350-ec235d7463c69784fb2de1cdf915279f37a714e1.zip |
fixed dialog positioning for mark
svn-id: r45857
-rw-r--r-- | engines/teenagent/callbacks.cpp | 7 | ||||
-rw-r--r-- | engines/teenagent/dialog.cpp | 6 | ||||
-rw-r--r-- | engines/teenagent/scene.cpp | 66 | ||||
-rw-r--r-- | engines/teenagent/teenagent.cpp | 8 |
4 files changed, 51 insertions, 36 deletions
diff --git a/engines/teenagent/callbacks.cpp b/engines/teenagent/callbacks.cpp index 91ce4b64f2..b638335e76 100644 --- a/engines/teenagent/callbacks.cpp +++ b/engines/teenagent/callbacks.cpp @@ -100,6 +100,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { setLan(2, 1); Dialog::show(scene, 0x748e, 914, 915, 0xe7, 0xd7, 2, 1); displayCredits(0xe3c2); + loadScene(42, 139, 156, 3); playSound(15, 20); playAnimation(916, 1); @@ -112,7 +113,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playAnimation(917, 1, true); waitAnimation(); displayCredits(0xe3e6); - + loadScene(40, 139, 156, 3); playMusic(3); Dialog::show(scene, 0x750d, 920, 924, 0xe7, 0xeb, 1, 2); //as i told you, our organization... @@ -120,7 +121,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playAnimation(925, 0, true); playAnimation(926, 1, true); waitAnimation(); - Dialog::show(scene, 0x78a6, 927, 920, 0xeb, 0xeb, 2, 1); + Dialog::show(scene, 0x78a6, 927, 920, 0xeb, 0xe7, 2, 1); displayCredits(0xe3ff); loadScene(39, 139, 156, 3); @@ -163,7 +164,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playAnimation(851, 0, true); playActorAnimation(934, true); waitAnimation(); - loadScene(10, 136, 153); + loadScene(10, 136, 153, 3); return true; diff --git a/engines/teenagent/dialog.cpp b/engines/teenagent/dialog.cpp index fa4f509014..17a2378fb5 100644 --- a/engines/teenagent/dialog.cpp +++ b/engines/teenagent/dialog.cpp @@ -29,8 +29,6 @@ namespace TeenAgent { void Dialog::show(Scene *scene, uint16 addr, uint16 animation1, uint16 animation2, byte color1, byte color2, byte slot1, byte slot2) { - --slot1; - --slot2; debug(0, "Dialog::show(%04x, %u:%u, %u:%u)", addr, slot1, animation1, slot2, animation2); Resources *res = Resources::instance(); int n = 0; @@ -102,9 +100,9 @@ void Dialog::show(Scene *scene, uint16 addr, uint16 animation1, uint16 animation SceneEvent e(SceneEvent::kMessage); e.message = message; e.color = color; - if (animation1 != 0 && color == color1) + if (color == color1) e.slot = slot1; - if (animation2 != 0 && color == color2) + if (color == color2) e.slot = slot2; scene->push(e); message.clear(); diff --git a/engines/teenagent/scene.cpp b/engines/teenagent/scene.cpp index 48e0df5fe5..ed0de66be9 100644 --- a/engines/teenagent/scene.cpp +++ b/engines/teenagent/scene.cpp @@ -392,8 +392,16 @@ bool Scene::render(OSystem *system) { } } + //render on + if (on.pixels != NULL) { + if (_id != 16 || getOns(16)[0] != 0) { + on.render(surface); //do not render boat on isle. I double checked all callbacks, there's no code switching off the boat :( + } + } + bool got_any_animation = false; + for (byte i = 0; i < 4; ++i) { Animation *a = custom_animation + i; Surface *s = a->currentFrame(); @@ -495,14 +503,6 @@ bool Scene::render(OSystem *system) { } } - //render on - if (on.pixels != NULL) { - if (_id != 16 || getOns(16)[0] != 0) { - on.render(surface); //do not render boat on isle. I double checked all callbacks, there's no code switching off the boat :( - } - } - - if (!message.empty()) { bool visible = true; if (message_first_frame != 0 && message_animation != NULL) { @@ -634,8 +634,8 @@ bool Scene::processEventQueue() { message_timer = 0; message_first_frame = current_event.first_frame; message_last_frame = current_event.last_frame; - if (current_event.slot < 4) { - message_animation = custom_animation + current_event.slot; + if (current_event.slot > 0) { + message_animation = custom_animation + (current_event.slot - 1); //else if (!animation[current_event.slot].empty()) // message_animation = animation + current_event.slot; } else @@ -652,16 +652,19 @@ bool Scene::processEventQueue() { } else { p = current_event.dst; } - //FIXME: rewrite it: - if (current_event.slot < 4) { - const Surface *s = custom_animation[current_event.slot].currentFrame(0); + + byte message_slot = current_event.slot; + if (message_slot != 0) { + --message_slot; + assert(message_slot < 4); + const Surface *s = custom_animation[message_slot].currentFrame(0); if (s == NULL) - s = animation[current_event.slot].currentFrame(0); + s = animation[message_slot].currentFrame(0); if (s != NULL) { p.x = s->x + s->w / 2; p.y = s->y; } else - warning("no animation in slot %u", current_event.slot); + warning("no animation in slot %u", message_slot); } message_pos = messagePosition(message, p); message_color = current_event.color; @@ -671,20 +674,33 @@ bool Scene::processEventQueue() { } break; - case SceneEvent::kPlayAnimation: - if (current_event.animation != 0) { - debug(0, "playing animation %u in slot %u", current_event.animation, current_event.slot & 3); - playAnimation(current_event.slot & 3, current_event.animation, (current_event.slot & 0x80) != 0, (current_event.slot & 0x40) != 0, (current_event.slot & 0x20) != 0); - } else { - debug(0, "cancelling animation in slot %u", current_event.slot & 3); - custom_animation[current_event.slot & 3].free(); + case SceneEvent::kPlayAnimation: { + byte slot = current_event.slot & 7; //0 - mark's + if (current_event.animation != 0) { + if (slot != 0) { + --slot; + debug(0, "playing animation %u in slot %u", current_event.animation, slot); + assert(slot < 4); + playAnimation(slot, current_event.animation, (current_event.slot & 0x80) != 0, (slot & 0x40) != 0, (slot & 0x20) != 0); + } + } else { + if (slot != 0) { + --slot; + debug(0, "cancelling animation in slot %u", slot); + assert(slot < 4); + custom_animation[slot].free(); + } + } + current_event.clear(); } - current_event.clear(); break; case SceneEvent::kPauseAnimation: - debug(0, "pause animation in slot %u", current_event.slot & 3); - custom_animation[current_event.slot & 3].paused = (current_event.slot & 0x80) != 0; + if (current_event.slot != 0) { + --current_event.slot; + debug(0, "pause animation in slot %u", current_event.slot & 3); + custom_animation[current_event.slot & 3].paused = (current_event.slot & 0x80) != 0; + } current_event.clear(); break; diff --git a/engines/teenagent/teenagent.cpp b/engines/teenagent/teenagent.cpp index f59271e14d..51f736d397 100644 --- a/engines/teenagent/teenagent.cpp +++ b/engines/teenagent/teenagent.cpp @@ -400,7 +400,7 @@ void TeenAgentEngine::displayMessage(const Common::String &str, byte color, uint SceneEvent event(SceneEvent::kMessage); event.message = str; event.color = color; - event.slot = 4; + event.slot = 0; event.dst.x = position % 320; event.dst.y = position / 320; @@ -414,7 +414,7 @@ void TeenAgentEngine::displayMessage(uint16 addr, byte color, uint16 position) { void TeenAgentEngine::displayAsyncMessage(uint16 addr, uint16 position, uint16 first_frame, uint16 last_frame, byte color) { SceneEvent event(SceneEvent::kMessage); event.message = parseMessage(addr); - event.slot = 4; + event.slot = 0; event.color = color; event.dst.x = position % 320; event.dst.y = position / 320; @@ -427,7 +427,7 @@ void TeenAgentEngine::displayAsyncMessage(uint16 addr, uint16 position, uint16 f void TeenAgentEngine::displayAsyncMessageInSlot(uint16 addr, byte slot, uint16 first_frame, uint16 last_frame, byte color) { SceneEvent event(SceneEvent::kMessage); event.message = parseMessage(addr); - event.slot = slot; + event.slot = slot + 1; event.color = color; event.first_frame = first_frame; event.last_frame = last_frame; @@ -504,7 +504,7 @@ void TeenAgentEngine::moveRel(int16 x, int16 y, byte o, bool warp) { void TeenAgentEngine::playAnimation(uint16 id, byte slot, bool async, bool ignore, bool loop) { SceneEvent event(SceneEvent::kPlayAnimation); event.animation = id; - event.slot = slot | (ignore? 0x20: 0) | (loop? 0x80: 0); + event.slot = (slot + 1) | (ignore? 0x20: 0) | (loop? 0x80: 0); scene->push(event); if (!async) waitAnimation(); |