aboutsummaryrefslogtreecommitdiff
path: root/engines/xeen/worldofxeen
diff options
context:
space:
mode:
authorPaul Gilbert2016-09-21 07:26:24 -0400
committerPaul Gilbert2016-09-21 07:26:24 -0400
commit2e4fc11320b90db0485a937ec14b3464f3195e0a (patch)
tree9590126c8a443ff25864cc4403632c36139c7b69 /engines/xeen/worldofxeen
parent41fea11ce68d21f900f39e65c35f766f2d7a5509 (diff)
downloadscummvm-rg350-2e4fc11320b90db0485a937ec14b3464f3195e0a.tar.gz
scummvm-rg350-2e4fc11320b90db0485a937ec14b3464f3195e0a.tar.bz2
scummvm-rg350-2e4fc11320b90db0485a937ec14b3464f3195e0a.zip
XEEN: Refactored doScroll to have it available to cutscenes
Diffstat (limited to 'engines/xeen/worldofxeen')
-rw-r--r--engines/xeen/worldofxeen/clouds_cutscenes.h2
-rw-r--r--engines/xeen/worldofxeen/cutscenes.cpp106
-rw-r--r--engines/xeen/worldofxeen/cutscenes.h88
-rw-r--r--engines/xeen/worldofxeen/darkside_cutscenes.h2
4 files changed, 2 insertions, 196 deletions
diff --git a/engines/xeen/worldofxeen/clouds_cutscenes.h b/engines/xeen/worldofxeen/clouds_cutscenes.h
index ff935a75fe..1440458c10 100644
--- a/engines/xeen/worldofxeen/clouds_cutscenes.h
+++ b/engines/xeen/worldofxeen/clouds_cutscenes.h
@@ -23,7 +23,7 @@
#ifndef XEEN_WORLDOFXEEN_CLOUDS_CUTSCENES_H
#define XEEN_WORLDOFXEEN_CLOUDS_CUTSCENES_H
-#include "xeen/worldofxeen/cutscenes.h"
+#include "xeen/cutscenes.h"
#include "xeen/xeen.h"
namespace Xeen {
diff --git a/engines/xeen/worldofxeen/cutscenes.cpp b/engines/xeen/worldofxeen/cutscenes.cpp
deleted file mode 100644
index 971070487f..0000000000
--- a/engines/xeen/worldofxeen/cutscenes.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "xeen/worldofxeen/cutscenes.h"
-#include "xeen/xeen.h"
-
-namespace Xeen {
-
-static const char *SUBTITLE_LINE = "\xC" "35\x3" "c\xB" "190\x9" "000%s";
-
-void Cutscenes::resetSubtitles(uint lineNum, uint defaultSize) {
- _subtitleLineNum = lineNum;
- _subtitleSize = defaultSize;
- recordTime();
-}
-
-void Cutscenes::showSubtitles(uint windowIndex) {
- Screen &screen = *_vm->_screen;
- Sound &sound = *_vm->_sound;
-
- if (sound._soundOn || _vm->shouldQuit()) {
- // Sound is on, so subtitles aren't needed
- resetSubtitles(0, 0);
- } else {
- if (timeElapsed() > 1) {
- ++_subtitleSize;
- const Common::String &line = _subtitles[_subtitleLineNum];
- Common::String lineStr(line.c_str(), line.c_str() + _subtitleSize);
- _subtitleLine = Common::String::format(SUBTITLE_LINE, lineStr.c_str());
-
- // If displayed a full line, then move to the next line
- if (_subtitleSize == line.size()) {
- _subtitleSize = 0;
- if (++_subtitleLineNum == _subtitles.size())
- _subtitleLineNum = 0;
- }
- }
-
- // Draw the box sprite
- if (!_boxSprites)
- // Not already loaded, so load it
- _boxSprites = new SpriteResource("box.vga");
- _boxSprites->draw(screen, 0, Common::Point(36, 189));
-
- // Write the subtitle line
- screen._windows[windowIndex].writeString(_subtitleLine);
- }
-
- screen.update();
-}
-
-void Cutscenes::freeSubtitles() {
- delete _boxSprites;
- _boxSprites = nullptr;
- _subtitles.clear();
-}
-
-bool Cutscenes::subtitlesWait(uint minTime) {
- EventsManager &events = *_vm->_events;
-
- events.updateGameCounter();
- recordTime();
- while (events.timeElapsed() < minTime || _subtitleSize != 0) {
- events.pollEventsAndWait();
- if (events.isKeyMousePressed())
- return false;
-
- showSubtitles();
- }
-
- return true;
-}
-
-void Cutscenes::recordTime() {
- _vm->_events->timeMark1();
-}
-
-uint Cutscenes::timeElapsed() {
- return _vm->_events->timeElapsed1();
-}
-
-uint Cutscenes::getSpeakingFrame(uint minFrame, uint maxFrame) {
- uint interval = g_system->getMillis() / 100;
- return minFrame + interval % (maxFrame + 1 - minFrame);
-}
-
-} // End of namespace Xeen
diff --git a/engines/xeen/worldofxeen/cutscenes.h b/engines/xeen/worldofxeen/cutscenes.h
deleted file mode 100644
index f4cb18e9c2..0000000000
--- a/engines/xeen/worldofxeen/cutscenes.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef XEEN_WORLDOFXEEN_CUTSCENES_H
-#define XEEN_WORLDOFXEEN_CUTSCENES_H
-
-#include "xeen/files.h"
-#include "xeen/sprites.h"
-
-namespace Xeen {
-
-#define WAIT(time) events.updateGameCounter(); \
- if (events.wait(time)) \
- return false
-
-class XeenEngine;
-
-class Cutscenes {
-protected:
- XeenEngine *_vm;
- StringArray _subtitles;
- SpriteResource *_boxSprites;
- uint _timeElapsed;
- Common::String _subtitleLine;
- uint _subtitleLineNum, _subtitleSize;
-protected:
- Cutscenes(XeenEngine *vm) : _vm(vm), _timeElapsed(0), _boxSprites(nullptr),
- _subtitleLineNum(0), _subtitleSize(0) {}
-
- /**
- * Resets the subtitles position
- */
- void resetSubtitles(uint lineNum, uint defaultSize = 1);
-
- /**
- * Free subtitles
- */
- void freeSubtitles();
-
- /**
- * Shows subtitles
- */
- void showSubtitles(uint windowIndex = 0);
-
- /**
- * Delays either the specified number of frames, or until
- * an entire subtitle line is shown if subtitles are on
- */
- bool subtitlesWait(uint minTime = 0);
-
- /**
- * Records the current execution time
- */
- void recordTime();
-
- /**
- * Returns the number of ticks since the last recordTime
- */
- uint timeElapsed();
-
- /**
- * Get a speaking frame from a range
- */
- uint getSpeakingFrame(uint minFrame, uint maxFrame);
-};
-
-} // End of namespace Xeen
-
-#endif /* XEEN_WORLDOFXEEN_CUTSCENES_H */
diff --git a/engines/xeen/worldofxeen/darkside_cutscenes.h b/engines/xeen/worldofxeen/darkside_cutscenes.h
index cbd961069f..7c6a1bfb08 100644
--- a/engines/xeen/worldofxeen/darkside_cutscenes.h
+++ b/engines/xeen/worldofxeen/darkside_cutscenes.h
@@ -23,7 +23,7 @@
#ifndef XEEN_WORLDOFXEEN_DARKSIDE_CUTSCENES_H
#define XEEN_WORLDOFXEEN_DARKSIDE_CUTSCENES_H
-#include "xeen/worldofxeen/cutscenes.h"
+#include "xeen/cutscenes.h"
namespace Xeen {