diff options
author | Eugene Sandulenko | 2018-03-26 00:38:58 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2018-03-26 00:54:17 +0200 |
commit | 9d984549d3276af2bbf79e9c054dd0cc22d7239b (patch) | |
tree | 91d5ba179167ab080d9c972d37108919bfe45e62 /engines | |
parent | cdad8a2e6bcb2a729fc93f3c0e7f2d8787f79e2f (diff) | |
download | scummvm-rg350-9d984549d3276af2bbf79e9c054dd0cc22d7239b.tar.gz scummvm-rg350-9d984549d3276af2bbf79e9c054dd0cc22d7239b.tar.bz2 scummvm-rg350-9d984549d3276af2bbf79e9c054dd0cc22d7239b.zip |
BLADERUNNER: Implemented Scores::open()
Diffstat (limited to 'engines')
-rw-r--r-- | engines/bladerunner/bladerunner.cpp | 1 | ||||
-rw-r--r-- | engines/bladerunner/ui/scores.cpp | 50 | ||||
-rw-r--r-- | engines/bladerunner/ui/scores.h | 13 |
3 files changed, 64 insertions, 0 deletions
diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp index a8e7df5e93..e34d2d61cf 100644 --- a/engines/bladerunner/bladerunner.cpp +++ b/engines/bladerunner/bladerunner.cpp @@ -1005,6 +1005,7 @@ void BladeRunnerEngine::handleKeyDown(Common::Event &event) { } if (_scores->isOpen()) { + _scores->handleKeyDown(event.kbd); return; } diff --git a/engines/bladerunner/ui/scores.cpp b/engines/bladerunner/ui/scores.cpp index 067c90a15a..83460b1b75 100644 --- a/engines/bladerunner/ui/scores.cpp +++ b/engines/bladerunner/ui/scores.cpp @@ -23,26 +23,61 @@ #include "bladerunner/ui/scores.h" #include "bladerunner/bladerunner.h" +#include "bladerunner/font.h" #include "bladerunner/savefile.h" +#include "bladerunner/text_resource.h" #include "bladerunner/vqa_player.h" +#include "common/keyboard.h" + namespace BladeRunner { Scores::Scores(BladeRunnerEngine *vm) { _vm = vm; + + _txtScorers = new TextResource(_vm); + _font = new Font(_vm); + reset(); } Scores::~Scores() { + delete _font; + delete _txtScorers; } void Scores::open() { + if (!_vm->openArchive("MODE.MIX")) { + return; + } + + _vqaPlayer = new VQAPlayer(_vm, &_vm->_surfaceBack); + + if (!_vqaPlayer->open("SCORE.VQA")) { + return; + } + + _vqaPlayer->setLoop(1, -1, 0, nullptr, nullptr); + + // TODO: Freeze game time + + _txtScorers->open("SCORERS"); + _font->open("TAHOMA24.FON", 640, 480, -1, 0, 0); + _font->setSpacing(1, 0); + + fill(); + + _isOpen = true; + _isLoaded = false; } bool Scores::isOpen() const { return _isOpen; } +void Scores::close() { +} + void Scores::set(int index, int value) { if (value > _scores[index]) { _scores[index] = value; @@ -52,17 +87,32 @@ void Scores::set(int index, int value) { _lastScoreValue = value; } +void Scores::handleKeyDown(const Common::KeyState &kbd) { + close(); +} + int Scores::handleMouseUp(int x, int y) { + if (_isLoaded) { + close(); + } + + _isLoaded = false; + return false; } int Scores::handleMouseDown(int x, int y) { + _isLoaded = true; + return false; } void Scores::tick() { } +void Scores::fill() { +} + void Scores::reset() { _isOpen = false; _isLoaded = false; diff --git a/engines/bladerunner/ui/scores.h b/engines/bladerunner/ui/scores.h index 3ae12defd7..80fd409675 100644 --- a/engines/bladerunner/ui/scores.h +++ b/engines/bladerunner/ui/scores.h @@ -25,12 +25,18 @@ #include "common/array.h" +namespace Common { +struct KeyState; +} + namespace BladeRunner { class BladeRunnerEngine; +class Font; class Shape; class SaveFileReadStream; class SaveFileWriteStream; +class TextResource; class VQAPlayer; class UIImagePicker; @@ -45,20 +51,27 @@ class Scores { int _lastScoreId; int _lastScoreValue; + Font *_font; + TextResource *_txtScorers; + public: Scores(BladeRunnerEngine *vm); ~Scores(); void open(); bool isOpen() const; + void close(); int query(int index) { return _scores[index]; } void set(int index, int value); + void handleKeyDown(const Common::KeyState &kbd); int handleMouseUp(int x, int y); int handleMouseDown(int x, int y); void tick(); + void fill(); + void reset(); void save(SaveFileWriteStream &f); void load(SaveFileReadStream &f); |