diff options
author | Sven Hesse | 2012-07-07 13:23:54 +0200 |
---|---|---|
committer | Sven Hesse | 2012-07-30 01:44:45 +0200 |
commit | 90415cf083d26e593ff05acb3a511c088a533b8b (patch) | |
tree | 763c3fccd4b96185026e84159d52b299c4ac40e9 /engines/gob/pregob | |
parent | d7c81c27555ed49c70bb6d8b1e60e6a8b5065c70 (diff) | |
download | scummvm-rg350-90415cf083d26e593ff05acb3a511c088a533b8b.tar.gz scummvm-rg350-90415cf083d26e593ff05acb3a511c088a533b8b.tar.bz2 scummvm-rg350-90415cf083d26e593ff05acb3a511c088a533b8b.zip |
GOB: Implement GCT text drawing in the end section
The end section is now complete.
Diffstat (limited to 'engines/gob/pregob')
-rw-r--r-- | engines/gob/pregob/onceupon/onceupon.cpp | 48 | ||||
-rw-r--r-- | engines/gob/pregob/onceupon/onceupon.h | 3 |
2 files changed, 43 insertions, 8 deletions
diff --git a/engines/gob/pregob/onceupon/onceupon.cpp b/engines/gob/pregob/onceupon/onceupon.cpp index f1b24c3353..8c617e2c41 100644 --- a/engines/gob/pregob/onceupon/onceupon.cpp +++ b/engines/gob/pregob/onceupon/onceupon.cpp @@ -94,6 +94,9 @@ enum ClownAnimation { kClownAnimationClownCry = 6 }; +// 12 seconds delay for one area full of GCT text +static const uint32 kGCTDelay = 12000; + namespace Gob { namespace OnceUpon { @@ -222,6 +225,9 @@ void OnceUpon::init() { // We start with no selected difficulty and at section 0 _difficulty = kDifficultyMAX; _section = 0; + + // Default name + _name = "Nemo"; } void OnceUpon::deinit() { @@ -1518,6 +1524,10 @@ bool OnceUpon::sectionEnd() { _vm->_draw->_backSurface->blit(endBackground, 0, 0, 288, 137, 16, 50); + GCTFile *endText = loadGCT(getLocFile("final.gc")); + endText->setArea(17, 18, 303, 41); + endText->setText(1, _name); + ANIFile ani(_vm, "fin.ani", 320); ANIList anims; @@ -1526,26 +1536,48 @@ bool OnceUpon::sectionEnd() { _vm->_draw->forceBlit(); + uint32 textStartTime = 0; + MenuAction action = kMenuActionNone; while (!_vm->shouldQuit() && (action == kMenuActionNone)) { - redrawAnim(anims); - - fadeIn(); - - endFrame(true); + // Check user input int16 mouseX, mouseY; MouseButtons mouseButtons; int16 key = checkInput(mouseX, mouseY, mouseButtons); - if ((key != 0) && (key != kKeyEscape)) - // Any key pressed => Quit - action = kMenuActionQuit; action = doIngameMenu(key, mouseButtons); + if (action != kMenuActionNone) + break; + + clearAnim(anims); + + // Pressed a key or mouse button => Skip to next area-full of text + if ((mouseButtons == kMouseButtonsLeft) || (key != 0)) + textStartTime = 0; + + // Draw the next area-full of text + uint32 now = _vm->_util->getTimeKey(); + if (!endText->finished() && ((textStartTime == 0) || (now >= (textStartTime + kGCTDelay)))) { + textStartTime = now; + + int16 left, top, right, bottom; + if (endText->clear(*_vm->_draw->_backSurface, left, top, right, bottom)) + _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom); + + if (endText->draw(*_vm->_draw->_backSurface, 0, *_plettre, 10, left, top, right, bottom)) + _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom); + } + + drawAnim(anims); + fadeIn(); + + endFrame(true); } freeAnims(anims); + delete endText; // Restart requested if (action == kMenuActionRestart) diff --git a/engines/gob/pregob/onceupon/onceupon.h b/engines/gob/pregob/onceupon/onceupon.h index 7ae3a39485..386d410c95 100644 --- a/engines/gob/pregob/onceupon/onceupon.h +++ b/engines/gob/pregob/onceupon/onceupon.h @@ -24,6 +24,7 @@ #define GOB_PREGOB_ONCEUPON_ONCEUPON_H #include "common/system.h" +#include "common/str.h" #include "gob/pregob/pregob.h" @@ -312,6 +313,8 @@ private: Difficulty _difficulty; ///< The current difficulty. int _section; ///< The current game section. + + Common::String _name; ///< The name of the child. }; } // End of namespace OnceUpon |