aboutsummaryrefslogtreecommitdiff
path: root/engines/supernova2/state.cpp
diff options
context:
space:
mode:
authorJaromir Wysoglad2019-06-05 12:26:28 +0200
committerThierry Crozat2019-07-28 15:09:14 +0100
commit3a5ea64e9cb41c83dd85eec32db228ebcfd850f6 (patch)
tree3be7cf5c4e164aa5af1c24c3b84b9625827770f6 /engines/supernova2/state.cpp
parent93561220b741a6f9a604205836a7b10e5af3abe5 (diff)
downloadscummvm-rg350-3a5ea64e9cb41c83dd85eec32db228ebcfd850f6.tar.gz
scummvm-rg350-3a5ea64e9cb41c83dd85eec32db228ebcfd850f6.tar.bz2
scummvm-rg350-3a5ea64e9cb41c83dd85eec32db228ebcfd850f6.zip
SUPERNOVA2: Finish the Checkout, add TV appearence
The TV appearence is for now just a guess, since right now I don't actually know how to get to it in the original game, so I don't know how it really looks like. Also the player cannot get to it yet, because the room containing the music chip (which is needed) isn't added yet.
Diffstat (limited to 'engines/supernova2/state.cpp')
-rw-r--r--engines/supernova2/state.cpp69
1 files changed, 65 insertions, 4 deletions
diff --git a/engines/supernova2/state.cpp b/engines/supernova2/state.cpp
index 4313aade76..25d3accd40 100644
--- a/engines/supernova2/state.cpp
+++ b/engines/supernova2/state.cpp
@@ -41,6 +41,7 @@ bool GameManager::serialize(Common::WriteStream *out) {
out->writeByte(_state._poleMagnet);
out->writeByte(_state._admission);
out->writeByte(_state._tipsy);
+ out->writeByte(_state._dark);
out->writeUint32LE(_state._eventTime);
out->writeSint32LE(_state._eventCallback);
@@ -74,6 +75,7 @@ bool GameManager::deserialize(Common::ReadStream *in, int version) {
_state._poleMagnet = in->readByte();
_state._admission = in->readByte();
_state._tipsy = in->readByte();
+ _state._dark = in->readByte();
_state._eventTime = in->readUint32LE();
_state._eventCallback = (EventFunction)in->readSint32LE();
_vm->setGameString(kStringMoney, Common::String::format("%d Xa", _state._money));
@@ -316,6 +318,7 @@ void GameManager::initState() {
_mouseY = -1;
_mouseField = -1;
_inventoryScroll = 0;
+ _restTime = 0;
_oldTime = g_system->getMillis();
_timerPaused = 0;
_timePaused = false;
@@ -340,6 +343,7 @@ void GameManager::initState() {
_state._poleMagnet = false;
_state._admission = 0;
_state._tipsy = false;
+ _state._dark = false;
_state._eventTime = kMaxTimerValue;
_state._eventCallback = kNoFn;
}
@@ -925,11 +929,13 @@ void GameManager::reply(const char *text, int aus1, int aus2) {
_vm->renderMessage(text, kMessageTop);
for (int z = (strlen(text) + 20) * _vm->_textSpeed / 40; z > 0; --z) {
- _vm->renderImage(aus1);
+ if (aus1)
+ _vm->renderImage(aus1);
waitOnInput(2);
if (_keyPressed || _mouseClicked)
z = 1;
- _vm->renderImage(aus2);
+ if (aus2)
+ _vm->renderImage(aus2);
waitOnInput(2);
if (_keyPressed || _mouseClicked)
z = 1;
@@ -1297,6 +1303,13 @@ bool GameManager::genericInteract(Action verb, Object &obj1, Object &obj2) {
return true;
}
+void GameManager::drawGUI() {
+ drawMapExits();
+ drawInventory();
+ drawStatus();
+ drawCommandBox();
+}
+
void GameManager::playCD() {
CursorMan.showMouse(false);
_vm->playSound(kMusicMadMonkeys);
@@ -1611,10 +1624,58 @@ void GameManager::playerTakeOut() {
takeObject(*o);
}
-void GameManager::sober()
-{
+void GameManager::sober() {
_state._tipsy = false;
}
+bool GameManager::talk(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;
+
+ while (animation_count) {
+ if (mod1)
+ _vm->renderImage(mod1);
+
+ if (waitOnInput(2, key)) {
+ _vm->removeMessage();
+ return key != Common::KEYCODE_ESCAPE && !_vm->shouldQuit();
+ }
+ if (mod2)
+ _vm->renderImage(mod2);
+
+ if (waitOnInput(2, key)) {
+ _vm->removeMessage();
+ return key != Common::KEYCODE_ESCAPE && !_vm->shouldQuit();
+ }
+ animation_count--;
+ }
+ if (_restTime == 0)
+ _vm->removeMessage();
+
+ return true;
+}
+
+bool GameManager::talkRest(int mod1, int mod2, int rest) {
+ Common::KeyCode key = Common::KEYCODE_INVALID;
+ while (rest) {
+ _vm->renderImage(mod1);
+ if (waitOnInput(2, key)) {
+ _vm->removeMessage();
+ return key != Common::KEYCODE_ESCAPE && !_vm->shouldQuit();
+ }
+ _vm->renderImage(mod2);
+ if (waitOnInput(2, key)) {
+ _vm->removeMessage();
+ return key != Common::KEYCODE_ESCAPE && !_vm->shouldQuit();
+ }
+ rest--;
+ }
+ return true;
+}
+
}