aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaromir Wysoglad2019-05-29 18:02:26 +0200
committerThierry Crozat2019-07-28 15:09:14 +0100
commitb6b26bb6bbc34c8f81ef938d74f885efb3f11b6f (patch)
treec8d1f3f3bc704c563232fcd8d7c2451506dd88ac
parenta86a397b261eceb2830a15f030e0aa5f50651343 (diff)
downloadscummvm-rg350-b6b26bb6bbc34c8f81ef938d74f885efb3f11b6f.tar.gz
scummvm-rg350-b6b26bb6bbc34c8f81ef938d74f885efb3f11b6f.tar.bz2
scummvm-rg350-b6b26bb6bbc34c8f81ef938d74f885efb3f11b6f.zip
SUPERNOVA2: Add intro animation
-rw-r--r--engines/supernova2/ms2_def.h12
-rw-r--r--engines/supernova2/rooms.cpp267
-rw-r--r--engines/supernova2/rooms.h27
-rw-r--r--engines/supernova2/state.cpp27
-rw-r--r--engines/supernova2/state.h2
-rw-r--r--engines/supernova2/supernova2.cpp2
6 files changed, 295 insertions, 42 deletions
diff --git a/engines/supernova2/ms2_def.h b/engines/supernova2/ms2_def.h
index 005f44cebe..a221814f0c 100644
--- a/engines/supernova2/ms2_def.h
+++ b/engines/supernova2/ms2_def.h
@@ -166,7 +166,7 @@ kString180, kString181, kString182, kString183, kString184,
kString185, kString186, kString187, kString188, kString189,
kString190, kString191, kString192, kString193, kString194,
kString195, kString196, kString197, kString198, kString199,
-kString200, kString201, kString202, kString203, kString204,
+kStringAirportEntrance, kString201, kString202, kString203, kString204,
kString205, kString206, kString207, kString208, kString209,
kString210, kString211, kString212, kString213, kString214,
kString215, kString216, kString217, kString218, kString219,
@@ -244,11 +244,11 @@ kString570, kString571, kString572, kString573, kString574,
kString575, kString576, kString577, kString578, kString579,
kString580, kString581, kString582, kString583, kString584,
kString585, kString586, kString587, kString588, kString589,
-kString590, kString591, kString592, kString593, kString594,
-kString595, kString596, kString597, kString598, kString599,
-kString600, kString601, kString602, kString603, kString604,
-kString605, kString606, kString607, kString608, kString609,
-kString610, kString611, kString612, kString613
+kStringIntro6, kStringIntro7, kStringIntro8, kStringIntroTV1, kStringIntroTV2,
+kStringIntroTV3, kStringIntroTV4, kStringIntroTV5, kStringIntroTV6, kStringIntroTV7,
+kStringIntroTV8, kStringIntroTV9, kStringIntroTV10, kStringIntroTV11, kStringIntroTV12,
+kStringIntroTV13, kStringIntroTV14, kStringIntroTV15, kStringIntroTV16, kStringIntro9,
+kStringIntro10, kStringIntro11, kStringIntro12, kStringIntro13, kStringIntro14
};
ObjectType operator|(ObjectType a, ObjectType b);
diff --git a/engines/supernova2/rooms.cpp b/engines/supernova2/rooms.cpp
index ea06d0cead..107eeb4b51 100644
--- a/engines/supernova2/rooms.cpp
+++ b/engines/supernova2/rooms.cpp
@@ -183,6 +183,7 @@ bool Room::interact(Action verb, Object &obj1, Object &obj2) {
Intro::Intro(Supernova2Engine *vm, GameManager *gm) {
_vm = vm;
_gm = gm;
+ _restTime = 0;
_fileNumber = -1;
_id = INTRO;
@@ -206,7 +207,14 @@ void Intro::onEntrance() {
_gm->_guiEnabled = false;
_vm->_allowSaveGame = false;
_vm->_allowLoadGame = false;
+
titleScreen();
+ thoughts1() && tvDialogue() && thoughts2();
+
+ _gm->changeRoom(AIRPORT);
+ _gm->_guiEnabled = true;
+ _vm->_allowSaveGame = true;
+ _vm->_allowLoadGame = true;
}
void Intro::titleScreen() {
@@ -219,7 +227,6 @@ void Intro::titleScreen() {
_vm->renderImage(0);
_vm->paletteFadeIn();
_gm->wait(15);
- //titleFadeIn();
_vm->renderImage(1);
_gm->wait(15);
_vm->renderImage(2);
@@ -235,48 +242,260 @@ void Intro::titleScreen() {
g_system->updateScreen();
g_system->delayMillis(_vm->_delay);
}
-
- _gm->wait(1);
- _gm->getInput();
+ _vm->paletteFadeOut();
+ CursorMan.showMouse(true);
}
-void Intro::titleFadeIn() {
- byte titlePaletteColor[] = {0xfe, 0xeb};
- byte titleNewColor[2][3] = {{255, 255, 255}, {199, 21, 21}};
- byte newColors[2][3];
+bool Intro::tvSay(int mod1, int mod2, int rest, MessagePosition pos, StringId id) {
+ Common::KeyCode key = Common::KEYCODE_INVALID;
+ const Common::String& text = _vm->getGameString(id);
+
+ _vm->renderMessage(text, pos);
+ int animation_count = (text.size() + 20) * (10 - rest) * _vm->_textSpeed / 400;
+ _restTime = (text.size() + 20) * rest * _vm->_textSpeed / 400;
- for (int brightness = 1; brightness <= 40; ++brightness) {
- for (int colorIndex = 0; colorIndex < 2; ++colorIndex) {
- for (int i = 0; i < 3; ++i) {
- newColors[colorIndex][i] = (titleNewColor[colorIndex][i] * brightness) / 40;
- }
+ while (animation_count) {
+ if (mod1)
+ _vm->renderImage(mod1);
+
+ if (_gm->waitOnInput(2, key)) {
+ _vm->removeMessage();
+ return key != Common::KEYCODE_ESCAPE;
}
+ if (mod2)
+ _vm->renderImage(mod2);
- _vm->_system->getPaletteManager()->setPalette(newColors[0], titlePaletteColor[0], 1);
- _vm->_system->getPaletteManager()->setPalette(newColors[1], titlePaletteColor[1], 1);
- _vm->_system->updateScreen();
- _vm->_system->delayMillis(_vm->_delay);
+ if (_gm->waitOnInput(2, key)) {
+ _vm->removeMessage();
+ return key != Common::KEYCODE_ESCAPE;
+ }
+ animation_count--;
}
+ if (_restTime == 0)
+ _vm->removeMessage();
+
+ return true;
}
-bool Intro::animate(int section1, int section2, int duration) {
+bool Intro::tvRest(int mod1, int mod2, int rest) {
+ Common::KeyCode key = Common::KEYCODE_INVALID;
+ while (rest) {
+ _vm->renderImage(mod1);
+ if (_gm->waitOnInput(2, key)) {
+ _vm->removeMessage();
+ return key != Common::KEYCODE_ESCAPE;
+ }
+ _vm->renderImage(mod2);
+ if (_gm->waitOnInput(2, key)) {
+ _vm->removeMessage();
+ return key != Common::KEYCODE_ESCAPE;
+ }
+ rest--;
+ }
return true;
}
-bool Intro::animate(int section1, int section2, int duration,
- MessagePosition position, StringId textId) {
+bool Intro::displayThoughtMessage(StringId id) {
+ Common::KeyCode key = Common::KEYCODE_INVALID;
+ const Common::String& text = _vm->getGameString(id);
+ _vm->renderMessage(text, kMessageNormal);
+ if (_gm->waitOnInput((text.size() + 20) * _vm->_textSpeed / 10, key)) {
+ _vm->removeMessage();
+ return key != Common::KEYCODE_ESCAPE;
+ }
+ _vm->removeMessage();
return true;
}
-bool Intro::animate(int section1, int section2, int section3, int section4,
- int duration, MessagePosition position, StringId textId) {
+bool Intro::thoughts1() {
+ _vm->setCurrentImage(41);
+ _vm->renderImage(0);
+ _vm->paletteFadeIn();
+
+ if(!displayThoughtMessage(kStringIntro6))
+ return false;
+
+ if(!displayThoughtMessage(kStringIntro7))
+ return false;
+
+ if(!displayThoughtMessage(kStringIntro8))
+ return false;
+
+ _vm->paletteFadeOut();
+ return true;
+}
+
+bool Intro::thoughts2() {
+ _vm->setCurrentImage(41);
+ _vm->renderImage(0);
+ _vm->paletteFadeIn();
+
+ if(!displayThoughtMessage(kStringIntro9))
+ return false;
+
+ if(!displayThoughtMessage(kStringIntro10))
+ return false;
+
+ if(!displayThoughtMessage(kStringIntro11))
+ return false;
+
+ _vm->paletteFadeOut();
+
+ _vm->setCurrentImage(2);
+ _vm->renderImage(0);
+ _vm->renderImage(1);
+ _vm->paletteFadeIn();
+
+ for (int i = 0; i < 35; i++)
+ {
+ _vm->renderImage((i % 3) + 2);
+ _gm->wait(3);
+ }
+ _vm->paletteFadeOut();
+
+ _vm->setCurrentImage(41);
+ _vm->renderImage(0);
+ _vm->renderImage(1);
+ _vm->paletteFadeIn();
+
+ if(!displayThoughtMessage(kStringIntro12))
+ return false;
+
+ if(!displayThoughtMessage(kStringIntro13))
+ return false;
+
+ if(!displayThoughtMessage(kStringIntro14))
+ return false;
+
+ _vm->paletteFadeOut();
return true;
}
-void Intro::cutscene() {
+bool Intro::tvDialogue() {
+ _vm->setCurrentImage(39);
+ _vm->renderImage(0);
+ _vm->paletteFadeIn();
+ _gm->wait(50);
+ _vm->setCurrentImage(40);
+ _vm->renderImage(0);
+ for (int i = 1; i < 11; i++)
+ {
+ _gm->wait(3);
+ _vm->renderImage(i);
+ }
+ _gm->wait(30);
+ _vm->renderImage(11);
+ _gm->wait(60);
+
+ _vm->_system->fillScreen(kColorBlack);
+ _vm->setCurrentImage(42);
+ _vm->renderImage(0);
+
+ if(!tvSay(1, 1+128, 0, kMessageLeft, kStringIntroTV1))
+ return false;
+
+ _vm->renderImage(4);
+ _gm->wait(3);
+ _vm->renderImage(6);
+
+ if(!tvSay(8, 6, 7, kMessageLeft, kStringIntroTV2))
+ return false;
+
+ _vm->renderImage(10);
+
+ if(!tvRest(8, 6, _restTime))
+ return false;
+
+ _vm->removeMessage();
+
+ if(!tvSay(8, 6, 0, kMessageLeft, kStringIntroTV3))
+ return false;
+
+ if(!tvSay(8, 6, 0, kMessageLeft, kStringIntroTV4))
+ return false;
+
+ _vm->renderImage(10 + 128);
+ _gm->wait(3);
+ _vm->renderImage(5);
+ _gm->wait(3);
+ _vm->renderImage(7);
+
+ if(!tvSay(9, 7, 0, kMessageCenter, kStringIntroTV5))
+ return false;
+
+ if(!tvSay(9, 7, 0, kMessageCenter, kStringIntroTV6))
+ return false;
+
+ if(!tvSay(9, 7, 0, kMessageCenter, kStringIntroTV7))
+ return false;
+
+ if(!tvSay(3, 3 + 128, 0, kMessageRight, kStringIntroTV8))
+ return false;
+
+ if(!tvSay(3, 3 + 128, 0, kMessageRight, kStringIntroTV9))
+ return false;
+
+ if(!tvSay(9, 7, 0, kMessageCenter, kStringIntroTV10))
+ return false;
+
+ if(!tvSay(3, 3 + 128, 0, kMessageRight, kStringIntroTV11))
+ return false;
+
+ if(!tvSay(3, 3 + 128, 0, kMessageRight, kStringIntroTV12))
+ return false;
+
+ if(!tvSay(9, 7, 8, kMessageCenter, kStringIntroTV13))
+ return false;
+
+ _vm->renderImage(4);
+
+ if(!tvRest(9, 7, 1))
+ return false;
+
+ _vm->renderImage(4 + 128);
+
+ if(!tvRest(9, 7, 3))
+ return false;
+
+ _vm->renderImage(4);
+
+ if(!tvRest(9, 7, 1))
+ return false;
+
+ _vm->renderImage(6);
+
+ if(!tvRest(9, 7, _restTime - 5))
+ return false;
+
+ _vm->removeMessage();
+
+ if(!tvSay(3, 3 + 128, 0, kMessageRight, kStringIntroTV14))
+ return false;
+
+ if(!tvSay(3, 3 + 128, 0, kMessageRight, kStringIntroTV15))
+ return false;
+
+ if(!tvSay(9, 7, 0, kMessageCenter, kStringIntroTV16))
+ return false;
+
+ _vm->paletteFadeOut();
+ return true;
}
-void Intro::leaveCutscene() {
+Airport::Airport(Supernova2Engine *vm, GameManager *gm) {
+ _vm = vm;
+ _gm = gm;
+
+ _fileNumber = 2;
+ _id = AIRPORT;
+ _shown[0] = kShownTrue;
+
}
+void Airport::onEntrance() {
+ if (hasSeen() == false) {
+ _vm->renderMessage(kStringAirportEntrance);
+ }
+ setRoomSeen(true);
+}
}
diff --git a/engines/supernova2/rooms.h b/engines/supernova2/rooms.h
index 2fcf636eea..9dbc6c4a80 100644
--- a/engines/supernova2/rooms.h
+++ b/engines/supernova2/rooms.h
@@ -80,20 +80,25 @@ public:
virtual void onEntrance();
private:
- bool animate(int section1, int section2, int duration);
- bool animate(int section1, int section2, int duration, MessagePosition position,
- StringId text);
- bool animate(int section1, int section2, int section3, int section4, int duration,
- MessagePosition position, StringId text);
-
void titleScreen();
- void titleFadeIn();
- void cutscene();
- void leaveCutscene();
-
- bool _shouldExit;
+ bool tvSay(int mod1, int mod2, int rest, MessagePosition pos, StringId id);
+ bool tvRest(int mod1, int mod2, int rest);
+ bool displayThoughtMessage(StringId id);
+ bool thoughts1();
+ bool tvDialogue();
+ bool thoughts2();
+
+ int _restTime;
Common::String _introText;
};
+class Airport : public Room {
+public:
+ Airport(Supernova2Engine *vm, GameManager *gm);
+ virtual void onEntrance();
+
+private:
+};
+
}
#endif // SUPERNOVA2_ROOMS_H
diff --git a/engines/supernova2/state.cpp b/engines/supernova2/state.cpp
index 24b86895d9..71adbf0af9 100644
--- a/engines/supernova2/state.cpp
+++ b/engines/supernova2/state.cpp
@@ -80,6 +80,7 @@ void GameManager::initState() {
void GameManager::initRooms() {
_rooms[INTRO] = new Intro(_vm, this);
+ _rooms[AIRPORT] = new Airport(_vm, this);
}
void GameManager::updateEvents() {
@@ -167,6 +168,32 @@ void GameManager::wait(int ticks) {
} while (g_system->getMillis() < end && !_vm->shouldQuit());
}
+void GameManager::waitOnInput(int ticks) {
+ uint32 end = g_system->getMillis() + ticksToMsec(ticks);
+ do {
+ g_system->delayMillis(_vm->_delay);
+ updateEvents();
+ g_system->updateScreen();
+ } while (g_system->getMillis() < end && !_vm->shouldQuit() && !_keyPressed && !_mouseClicked);
+}
+
+bool GameManager::waitOnInput(int ticks, Common::KeyCode &keycode) {
+ keycode = Common::KEYCODE_INVALID;
+ uint32 end = g_system->getMillis() + ticksToMsec(ticks);
+ do {
+ g_system->delayMillis(_vm->_delay);
+ updateEvents();
+ g_system->updateScreen();
+ if (_keyPressed) {
+ keycode = _key.keycode;
+ _key.reset();
+ return true;
+ } else if (_mouseClicked)
+ return true;
+ } while (g_system->getMillis() < end && !_vm->shouldQuit());
+ return false;
+}
+
void GameManager::changeRoom(RoomId id) {
_currentRoom = _rooms[id];
_newRoom = true;
diff --git a/engines/supernova2/state.h b/engines/supernova2/state.h
index 8672a41a57..9c7ad22dde 100644
--- a/engines/supernova2/state.h
+++ b/engines/supernova2/state.h
@@ -77,6 +77,8 @@ public:
void getInput();
void changeRoom(RoomId id);
void wait(int ticks);
+ void waitOnInput(int ticks);
+ bool waitOnInput(int ticks, Common::KeyCode &keycode);
void resetInputState();
private:
diff --git a/engines/supernova2/supernova2.cpp b/engines/supernova2/supernova2.cpp
index fd19ab6a4a..f2a21a6d90 100644
--- a/engines/supernova2/supernova2.cpp
+++ b/engines/supernova2/supernova2.cpp
@@ -60,7 +60,7 @@ Supernova2Engine::Supernova2Engine(OSystem *syst)
, _sleepAutoSave(nullptr)
, _sleepAuoSaveVersion(-1)
, _delay(33)
- , _textSpeed(1) {
+ , _textSpeed(kTextSpeed[2]) {
if (ConfMan.hasKey("textspeed"))
_textSpeed = ConfMan.getInt("textspeed");