aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Menshakov2009-09-13 09:54:53 +0000
committerVladimir Menshakov2009-09-13 09:54:53 +0000
commite53de46b4fd1357cce5bb53c02de2c88f85169cc (patch)
treeb79bbc6c12ca03bc803ef2c9406676f1a6e14446
parent94d7dad3affff49d014c1985955466ec4931f15b (diff)
downloadscummvm-rg350-e53de46b4fd1357cce5bb53c02de2c88f85169cc.tar.gz
scummvm-rg350-e53de46b4fd1357cce5bb53c02de2c88f85169cc.tar.bz2
scummvm-rg350-e53de46b4fd1357cce5bb53c02de2c88f85169cc.zip
added simple credits support for the intro.
svn-id: r44047
-rw-r--r--engines/teenagent/resources.cpp4
-rw-r--r--engines/teenagent/resources.h2
-rw-r--r--engines/teenagent/scene.cpp18
-rw-r--r--engines/teenagent/scene.h2
-rw-r--r--engines/teenagent/teenagent.cpp37
-rw-r--r--engines/teenagent/teenagent.h3
6 files changed, 58 insertions, 8 deletions
diff --git a/engines/teenagent/resources.cpp b/engines/teenagent/resources.cpp
index 1b4ec7d86c..c13af1febf 100644
--- a/engines/teenagent/resources.cpp
+++ b/engines/teenagent/resources.cpp
@@ -73,6 +73,10 @@ bool Resources::loadArchives(const ADGameDescription * gd) {
sam_sam.open("sam_sam.res");
font7.load(7);
+ font7.width_pack = 1;
+ font7.height = 10;
+ font8.load(8);
+ font8.height = 31;
return true;
}
diff --git a/engines/teenagent/resources.h b/engines/teenagent/resources.h
index 80419f58a9..f62b5e321f 100644
--- a/engines/teenagent/resources.h
+++ b/engines/teenagent/resources.h
@@ -49,7 +49,7 @@ public:
Pack varia, off, on, ons, lan000, lan500, mmm, sam_mmm, sam_sam;
Segment cseg, dseg, eseg;
- Font font7;
+ Font font7, font8;
};
} // End of namespace TeenAgent
diff --git a/engines/teenagent/scene.cpp b/engines/teenagent/scene.cpp
index 9a906c1f0d..87bb958fdc 100644
--- a/engines/teenagent/scene.cpp
+++ b/engines/teenagent/scene.cpp
@@ -276,6 +276,17 @@ bool Scene::processEvent(const Common::Event &event) {
bool Scene::render(OSystem * system) {
//render background
+ Resources * res = Resources::instance();
+ if (current_event.type == SceneEvent::CreditsMessage) {
+ system->fillScreen(0);
+ Graphics::Surface * surface = system->lockScreen();
+ res->font8.color = current_event.color;
+ res->font8.shadow_color = current_event.orientation;
+ res->font8.render(surface, current_event.dst.x, current_event.dst.y, message);
+ system->unlockScreen();
+ return true;
+ }
+
bool busy = false;
system->copyRectToScreen((const byte *)background.pixels, background.pitch, 0, 0, background.w, background.h);
@@ -373,7 +384,7 @@ bool Scene::render(OSystem * system) {
*/
if (!message.empty()) {
- Resources::instance()->font7.render(surface, message_pos.x, message_pos.y, message);
+ res->font7.render(surface, message_pos.x, message_pos.y, message);
busy = true;
}
@@ -439,11 +450,12 @@ bool Scene::processEventQueue() {
moveTo(dst, current_event.orientation);
} break;
- case SceneEvent::Message: {
+ case SceneEvent::CreditsMessage:
+ case SceneEvent::Message:
//debug(0, "pop(%04x)", current_event.message);
message = current_event.message;
message_pos = messagePosition(message, position);
- } break;
+ break;
case SceneEvent::PlayAnimation: {
debug(0, "playing animation %u", current_event.animation);
diff --git a/engines/teenagent/scene.h b/engines/teenagent/scene.h
index 8829cf0dec..49af961509 100644
--- a/engines/teenagent/scene.h
+++ b/engines/teenagent/scene.h
@@ -43,7 +43,7 @@ struct SceneEvent {
None, Message, Walk, PlayAnimation, PlayActorAnimation,
LoadScene, SetOn, SetLan, PlayMusic,
PlaySound, EnableObject, WaitForAnimation,
- Quit
+ CreditsMessage, Quit
} type;
Common::String message;
diff --git a/engines/teenagent/teenagent.cpp b/engines/teenagent/teenagent.cpp
index 3aaf33eed4..055f7ad646 100644
--- a/engines/teenagent/teenagent.cpp
+++ b/engines/teenagent/teenagent.cpp
@@ -329,8 +329,9 @@ Object * TeenAgentEngine::findObject(int id, const Common::Point &point) {
}
void TeenAgentEngine::displayMessage(const Common::String &str, byte color) {
- if (str.empty())
+ if (str.empty()) {
return;
+ }
SceneEvent event(SceneEvent::Message);
event.message = str;
event.color = color;
@@ -338,7 +339,7 @@ void TeenAgentEngine::displayMessage(const Common::String &str, byte color) {
}
-void TeenAgentEngine::displayMessage(uint16 addr, byte color) {
+Common::String TeenAgentEngine::parseMessage(uint16 addr) {
Common::String message;
for (
const char * str = (const char *)Resources::instance()->dseg.ptr(addr);
@@ -348,7 +349,37 @@ void TeenAgentEngine::displayMessage(uint16 addr, byte color) {
char c = str[0];
message += c != 0 && c != -1? c: '\n';
}
- displayMessage(message, color);
+ if (message.empty()) {
+ warning("empty message parsed for %04x", addr);
+ }
+ return message;
+}
+
+
+void TeenAgentEngine::displayMessage(uint16 addr, byte color) {
+ displayMessage(parseMessage(addr), color);
+}
+
+void TeenAgentEngine::displayCredits(uint16 addr) {
+ SceneEvent event(SceneEvent::CreditsMessage);
+
+ const byte * src = Resources::instance()->dseg.ptr(addr);
+ event.orientation = *src++;
+ event.color = *src++;
+
+ event.dst.y = *src;
+ while(true) {
+ ++src; //skip y position
+ Common::String line((const char *)src);
+ event.message += line;
+ src += line.size() + 1;
+ if (*src == 0)
+ break;
+ event.message += "\n";
+ }
+ int w = Resources::instance()->font8.render(NULL, 0, 0, event.message);
+ event.dst.x = (320 - w) / 2;
+ scene->push(event);
}
void TeenAgentEngine::moveTo(const Common::Point & dst, byte o, bool warp) {
diff --git a/engines/teenagent/teenagent.h b/engines/teenagent/teenagent.h
index 31d29c045f..1c10b9e556 100644
--- a/engines/teenagent/teenagent.h
+++ b/engines/teenagent/teenagent.h
@@ -64,9 +64,12 @@ public:
bool processCallback(uint16 addr);
inline Scene * getScene() { return scene; }
+ static Common::String parseMessage(uint16 addr);
+
//event driven:
void displayMessage(uint16 addr, byte color = 0xd1);
void displayMessage(const Common::String &str, byte color = 0xd1);
+ void displayCredits(uint16 addr);
void moveTo(const Common::Point & dst, byte o, bool warp = false);
void moveTo(uint16 x, uint16 y, byte o, bool warp = false);
void moveTo(Object * obj);