aboutsummaryrefslogtreecommitdiff
path: root/engines/teenagent
diff options
context:
space:
mode:
authorVladimir Menshakov2009-09-13 12:48:57 +0000
committerVladimir Menshakov2009-09-13 12:48:57 +0000
commitba9c347d93510e6177df2aea19127c982c592055 (patch)
tree1c7f38c4ddac1f25bbf8b95b7391be9514c0c6a7 /engines/teenagent
parent6d24808bc2ae903d291e7005e0604f07896e4bd1 (diff)
downloadscummvm-rg350-ba9c347d93510e6177df2aea19127c982c592055.tar.gz
scummvm-rg350-ba9c347d93510e6177df2aea19127c982c592055.tar.bz2
scummvm-rg350-ba9c347d93510e6177df2aea19127c982c592055.zip
added hide/showActor, fixed intro, reverted straight animation order
svn-id: r44055
Diffstat (limited to 'engines/teenagent')
-rw-r--r--engines/teenagent/callbacks.cpp2
-rw-r--r--engines/teenagent/scene.cpp70
-rw-r--r--engines/teenagent/scene.h6
-rw-r--r--engines/teenagent/teenagent.cpp12
-rw-r--r--engines/teenagent/teenagent.h2
5 files changed, 61 insertions, 31 deletions
diff --git a/engines/teenagent/callbacks.cpp b/engines/teenagent/callbacks.cpp
index 073abfbc12..4304c14aa4 100644
--- a/engines/teenagent/callbacks.cpp
+++ b/engines/teenagent/callbacks.cpp
@@ -89,6 +89,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
switch(addr) {
case 0x024c: //intro
+ hideActor();
loadScene(41, 139, 156, 3);
playSound(41, 12);
playAnimation(912, 1);
@@ -135,6 +136,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playAnimation(928, 1);
setOns(0, 112);
Dialog::show(scene, 0x78e1, 929, 0, 0xd1); //he's coming
+ showActor();
moveTo(319, 150, 1, true);
moveTo(63, 150, 1);
displayMessage(0x5da8); //fixme: with delay!
diff --git a/engines/teenagent/scene.cpp b/engines/teenagent/scene.cpp
index 8234944243..b72b0d54a2 100644
--- a/engines/teenagent/scene.cpp
+++ b/engines/teenagent/scene.cpp
@@ -37,7 +37,7 @@ Scene::Scene() : intro(false), _engine(NULL),
_system(NULL),
_id(0), ons(0), walkboxes(0),
orientation(Object::ActorRight),
- current_event(SceneEvent::None) {}
+ current_event(SceneEvent::None), hide_actor(false) {}
void Scene::warp(const Common::Point & _point, byte o) {
Common::Point point(_point);
@@ -278,6 +278,8 @@ bool Scene::processEvent(const Common::Event &event) {
events.clear();
sounds.clear();
current_event.clear();
+ for(int i = 0; i < 4; ++i)
+ custom_animations[i].free();
_engine->playMusic(4);
init(10, Common::Point(136, 153));
}
@@ -322,7 +324,7 @@ bool Scene::render(OSystem * system) {
bool got_any_animation = false;
- for (int i = 3; i >= 0; --i) {
+ for (int i = 0; i < 4; ++i) {
Animation *a = custom_animations + i;
Surface *s = a->currentFrame();
if (s != NULL) {
@@ -352,35 +354,37 @@ bool Scene::render(OSystem * system) {
}
}
- Surface * mark = actor_animation.currentFrame();
- if (mark == NULL) {
- actor_animation.free();
-
- if (destination != position) {
- Common::Point dp(destination.x - position0.x, destination.y - position0.y);
- int o;
- if (ABS(dp.x) > ABS(dp.y))
- o = dp.x > 0? Object::ActorRight: Object::ActorLeft;
- else
- o = dp.y > 0? Object::ActorDown: Object::ActorUp;
+ if (!hide_actor) {
+ Surface * mark = actor_animation.currentFrame();
+ if (mark == NULL) {
+ actor_animation.free();
+
+ if (destination != position) {
+ Common::Point dp(destination.x - position0.x, destination.y - position0.y);
+ int o;
+ if (ABS(dp.x) > ABS(dp.y))
+ o = dp.x > 0? Object::ActorRight: Object::ActorLeft;
+ else
+ o = dp.y > 0? Object::ActorDown: Object::ActorUp;
- position.x = position0.x + dp.x * progress / progress_total;
- position.y = position0.y + dp.y * progress / progress_total;
- teenagent.render(surface, position, o, 1);
- ++progress;
- if (progress >= progress_total) {
- position = destination;
- if (orientation == 0)
- orientation = o; //save last orientation
- nextEvent();
+ position.x = position0.x + dp.x * progress / progress_total;
+ position.y = position0.y + dp.y * progress / progress_total;
+ teenagent.render(surface, position, o, 1);
+ ++progress;
+ if (progress >= progress_total) {
+ position = destination;
+ if (orientation == 0)
+ orientation = o; //save last orientation
+ nextEvent();
+ } else
+ busy = true;
} else
- busy = true;
- } else
- teenagent.render(surface, position, orientation, 0);
- } else {
- mark->render(surface);
- busy = true;
- got_any_animation = true;
+ teenagent.render(surface, position, orientation, 0);
+ } else {
+ mark->render(surface);
+ busy = true;
+ got_any_animation = true;
+ }
}
if (current_event.type == SceneEvent::WaitForAnimation && !got_any_animation) {
@@ -507,6 +511,11 @@ bool Scene::processEventQueue() {
current_event.clear();
} break;
+ case SceneEvent::HideActor: {
+ hide_actor = current_event.color != 0;
+ current_event.clear();
+ } break;
+
case SceneEvent::WaitForAnimation:
debug(0, "waiting for the animation");
break;
@@ -520,6 +529,9 @@ bool Scene::processEventQueue() {
error("empty/unhandler event[%d]", (int)current_event.type);
}
}
+ if (events.empty()) {
+ hide_actor = false;
+ }
return !current_event.empty();
}
diff --git a/engines/teenagent/scene.h b/engines/teenagent/scene.h
index 5749901fa1..48a9fe35fc 100644
--- a/engines/teenagent/scene.h
+++ b/engines/teenagent/scene.h
@@ -42,8 +42,9 @@ struct SceneEvent {
enum Type {
None, Message, Walk, PlayAnimation, PlayActorAnimation,
LoadScene, SetOn, SetLan, PlayMusic,
- PlaySound, EnableObject, WaitForAnimation,
- CreditsMessage, Quit
+ PlaySound, EnableObject, HideActor,
+ WaitForAnimation, CreditsMessage,
+ Quit
} type;
Common::String message;
@@ -161,6 +162,7 @@ private:
typedef Common::List<SceneEvent> EventList;
EventList events;
SceneEvent current_event;
+ bool hide_actor;
struct Sound {
byte id, delay;
diff --git a/engines/teenagent/teenagent.cpp b/engines/teenagent/teenagent.cpp
index 7e45cf13f5..60e7dec39a 100644
--- a/engines/teenagent/teenagent.cpp
+++ b/engines/teenagent/teenagent.cpp
@@ -499,6 +499,18 @@ void TeenAgentEngine::disableObject(byte id, byte scene_id) {
scene->push(event);
}
+void TeenAgentEngine::hideActor() {
+ SceneEvent event(SceneEvent::HideActor);
+ event.color = 1;
+ scene->push(event);
+}
+
+void TeenAgentEngine::showActor() {
+ SceneEvent event(SceneEvent::HideActor);
+ event.color = 0;
+ scene->push(event);
+}
+
void TeenAgentEngine::waitAnimation() {
SceneEvent event(SceneEvent::WaitForAnimation);
scene->push(event);
diff --git a/engines/teenagent/teenagent.h b/engines/teenagent/teenagent.h
index 1c10b9e556..2adafabdcd 100644
--- a/engines/teenagent/teenagent.h
+++ b/engines/teenagent/teenagent.h
@@ -88,6 +88,8 @@ public:
void playSoundNow(byte id);
void enableObject(byte id, byte scene_id = 0);
void disableObject(byte id, byte scene_id = 0);
+ void hideActor();
+ void showActor();
void waitAnimation();
Common::RandomSource random;