aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwhitertandrek2018-03-25 22:32:07 +0300
committerEugene Sandulenko2018-06-28 23:51:32 +0200
commit0e39a87862253841e133a8f098b492cd4f5dd255 (patch)
tree1f5c994f379880bc4b65937e93e8997df21895e2
parentc6df869fec46858d25d294854c1e446ca47fd85d (diff)
downloadscummvm-rg350-0e39a87862253841e133a8f098b492cd4f5dd255.tar.gz
scummvm-rg350-0e39a87862253841e133a8f098b492cd4f5dd255.tar.bz2
scummvm-rg350-0e39a87862253841e133a8f098b492cd4f5dd255.zip
PINK: Implemented changing page and module, but without unloading old page. For now it can play logo of Wanderlust Interactive, then logo of MGM and Localizer Logo.
-rw-r--r--engines/pink/cel_decoder.cpp7
-rw-r--r--engines/pink/cel_decoder.h2
-rw-r--r--engines/pink/director.cpp30
-rw-r--r--engines/pink/director.h11
-rw-r--r--engines/pink/file.cpp2
-rw-r--r--engines/pink/objects/actions/action_cel.cpp9
-rw-r--r--engines/pink/objects/actions/action_cel.h1
-rw-r--r--engines/pink/objects/actions/action_sound.cpp9
-rw-r--r--engines/pink/objects/actions/action_still.cpp4
-rw-r--r--engines/pink/objects/actions/walk_action.cpp3
-rw-r--r--engines/pink/objects/actors/actor.cpp5
-rw-r--r--engines/pink/objects/actors/actor.h2
-rw-r--r--engines/pink/objects/actors/lead_actor.cpp14
-rw-r--r--engines/pink/objects/actors/lead_actor.h1
-rw-r--r--engines/pink/objects/module.cpp59
-rw-r--r--engines/pink/objects/module.h6
-rw-r--r--engines/pink/objects/pages/game_page.cpp18
-rw-r--r--engines/pink/objects/pages/game_page.h2
-rw-r--r--engines/pink/objects/sequences/sequence.cpp23
-rw-r--r--engines/pink/objects/sequences/sequence.h2
-rw-r--r--engines/pink/objects/sequences/sequencer.cpp10
-rw-r--r--engines/pink/objects/sequences/sequencer.h7
-rw-r--r--engines/pink/pink.cpp46
-rw-r--r--engines/pink/pink.h22
24 files changed, 198 insertions, 97 deletions
diff --git a/engines/pink/cel_decoder.cpp b/engines/pink/cel_decoder.cpp
index bff0e4a5bc..7e7a9939e9 100644
--- a/engines/pink/cel_decoder.cpp
+++ b/engines/pink/cel_decoder.cpp
@@ -64,6 +64,13 @@ uint32 CelDecoder::getY() {
return track->getY();
}
+Graphics::Surface *CelDecoder::getCurrentFrame() {
+ CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
+ if (!track)
+ return nullptr;
+ return nullptr;
+}
+
CelDecoder::CelVideoTrack::CelVideoTrack(Common::SeekableReadStream *stream, uint16 frameCount, uint16 width, uint16 height, bool skipHeader)
: FlicVideoTrack(stream, frameCount, width, height, 1) {
readHeader();
diff --git a/engines/pink/cel_decoder.h b/engines/pink/cel_decoder.h
index c096793f1c..ef43e809f8 100644
--- a/engines/pink/cel_decoder.h
+++ b/engines/pink/cel_decoder.h
@@ -33,6 +33,8 @@ public:
uint32 getX();
uint32 getY();
+ Graphics::Surface *getCurrentFrame();
+
virtual bool loadStream(Common::SeekableReadStream *stream);
protected:
diff --git a/engines/pink/director.cpp b/engines/pink/director.cpp
index f45948b9e7..18ec0b2a00 100644
--- a/engines/pink/director.cpp
+++ b/engines/pink/director.cpp
@@ -21,6 +21,7 @@
*/
#include "director.h"
+#include <engines/pink/objects/actions/action_sound.h>
#include <engines/pink/objects/actions/action_cel.h>
#include "graphics/surface.h"
#include "graphics/palette.h"
@@ -47,7 +48,14 @@ void Director::draw() {
}
void Director::addSprite(ActionCEL *sprite) {
- _sprites.push_back(sprite); //TODO impl sorting
+ _sprites.push_back(sprite);
+ int i;
+ for (i = _sprites.size() - 1; i > 0 ; --i) {
+ if (sprite->getZ() < _sprites[i - 1]->getZ()){
+ _sprites[i] = _sprites[i - 1];
+ } else break;
+ }
+ _sprites[i] = sprite;
}
void Director::removeSprite(ActionCEL *sprite) {
@@ -63,4 +71,24 @@ void Director::setPallette(const byte *pallete) {
_system->getPaletteManager()->setPalette(pallete, 0, 256);
}
+void Director::update() {
+ for (int i = 0; i < _sounds.size(); ++i) {
+ _sounds[i]->update();
+ }
+ for (int i = 0; i < _sprites.size(); ++i) {
+ _sprites[i]->update();
+ }
+}
+
+void Director::addSound(ActionSound *sound) {
+ _sounds.push_back(sound);
+}
+
+void Director::removeSound(ActionSound *sound) {
+ for (int i = 0; i < _sounds.size(); ++i) {
+ if (_sounds[i] == sound)
+ _sounds.remove_at(i);
+ }
+}
+
} \ No newline at end of file
diff --git a/engines/pink/director.h b/engines/pink/director.h
index 0bd44f41aa..ac88bce52c 100644
--- a/engines/pink/director.h
+++ b/engines/pink/director.h
@@ -29,22 +29,27 @@
namespace Pink {
class ActionCEL;
+class ActionSound;
class Director {
public:
Director(OSystem *system);
- //void addSoundObject();
- //void removeSound();
- //void updateSoundAction
//CActor *getActorByCoords()
void draw();
+ void update();
+
void addSprite(ActionCEL *sprite);
void removeSprite(ActionCEL *sprite);
void setPallette(const byte *pallete);
+
+ void addSound(ActionSound* sound);
+ void removeSound(ActionSound* sound);
+
private:
OSystem *_system;
Common::Array<ActionCEL*> _sprites;
+ Common::Array<ActionSound*> _sounds;
};
} // End of namespace Pink
diff --git a/engines/pink/file.cpp b/engines/pink/file.cpp
index 996a13d352..d5e9059a94 100644
--- a/engines/pink/file.cpp
+++ b/engines/pink/file.cpp
@@ -167,7 +167,7 @@ void ResourceDescription::load(Common::File &file) {
uint16 temp;
file.read(&temp, sizeof(temp));
- inBro = temp ? true : false;
+ inBro = temp;
}
} // End of namespace Pink \ No newline at end of file
diff --git a/engines/pink/objects/actions/action_cel.cpp b/engines/pink/objects/actions/action_cel.cpp
index abfc59373e..dc18ee3a39 100644
--- a/engines/pink/objects/actions/action_cel.cpp
+++ b/engines/pink/objects/actions/action_cel.cpp
@@ -64,8 +64,17 @@ CelDecoder *ActionCEL::getDecoder() {
bool ActionCEL::initPallete(Director *director) {
_decoder = _actor->getPage()->loadCel(_fileName);
_decoder->decodeNextFrame();
+ _decoder->rewind();
director->setPallette(_decoder->getPalette());
+
return 1;
}
+void ActionCEL::update() {
+ if (_decoder->endOfVideo()){
+ _decoder->stop();
+ _actor->endAction();
+ }
+}
+
} // End of namespace Pink \ No newline at end of file
diff --git a/engines/pink/objects/actions/action_cel.h b/engines/pink/objects/actions/action_cel.h
index 4dc37724df..7c0f7505d4 100644
--- a/engines/pink/objects/actions/action_cel.h
+++ b/engines/pink/objects/actions/action_cel.h
@@ -36,6 +36,7 @@ public:
virtual void deserialize(Archive &archive);
virtual void start(bool unk);
virtual void end();
+ virtual void update();
uint32 getZ();
CelDecoder *getDecoder();
diff --git a/engines/pink/objects/actions/action_sound.cpp b/engines/pink/objects/actions/action_sound.cpp
index 38f8687d33..42d279553b 100644
--- a/engines/pink/objects/actions/action_sound.cpp
+++ b/engines/pink/objects/actions/action_sound.cpp
@@ -26,6 +26,7 @@
#include <engines/pink/objects/actors/actor.h>
#include <engines/pink/objects/pages/game_page.h>
#include <engines/pink/sound.h>
+#include "engines/pink/pink.h"
namespace Pink {
@@ -53,6 +54,10 @@ void ActionSound::start(bool unk) {
Audio::Mixer::SoundType soundType = _isBackground ? Audio::Mixer::SoundType::kMusicSoundType
: Audio::Mixer::SoundType::kSpeechSoundType;
+
+ Director *director = _actor->getPage()->getGame()->getDirector();
+ director->addSound(this);
+
_sound->play(soundType, _volume, _isLoop);
if (_isLoop)
_actor->endAction();
@@ -62,6 +67,10 @@ void ActionSound::start(bool unk) {
void ActionSound::end() {
debug("ActionSound %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
+
+ Director *director = _actor->getPage()->getGame()->getDirector();
+ director->removeSound(this);
+
_sound->stop();
delete _sound;
_sound = nullptr;
diff --git a/engines/pink/objects/actions/action_still.cpp b/engines/pink/objects/actions/action_still.cpp
index 563af93c28..c49e52ae1d 100644
--- a/engines/pink/objects/actions/action_still.cpp
+++ b/engines/pink/objects/actions/action_still.cpp
@@ -34,8 +34,8 @@ void ActionStill::deserialize(Archive &archive) {
}
void ActionStill::toConsole() {
- debug("\tActionStill: _name = %s, _fileName = %s, _startFrame = %u",
- _name.c_str(), _fileName.c_str(), _startFrame);
+ debug("\tActionStill: _name = %s, _fileName = %s, _z =%u _startFrame = %u",
+ _name.c_str(), _fileName.c_str(), _z, _startFrame);
}
void ActionStill::end() {
diff --git a/engines/pink/objects/actions/walk_action.cpp b/engines/pink/objects/actions/walk_action.cpp
index 39be8f4443..7b7c3e39e3 100644
--- a/engines/pink/objects/actions/walk_action.cpp
+++ b/engines/pink/objects/actions/walk_action.cpp
@@ -22,14 +22,13 @@
#include "walk_action.h"
#include <engines/pink/archive.h>
-#include <common/debug.h>
namespace Pink {
void WalkAction::deserialize(Archive &archive) {
ActionCEL::deserialize(archive);
uint32 calcFramePositions = archive.readDWORD();
- _toCalcFramePositions = calcFramePositions ? true : false;
+ _toCalcFramePositions = calcFramePositions;
}
void WalkAction::toConsole() {
diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp
index e612c83ae6..ba270ff7a5 100644
--- a/engines/pink/objects/actors/actor.cpp
+++ b/engines/pink/objects/actors/actor.cpp
@@ -108,14 +108,15 @@ Action *Actor::getAction() const {
}
bool Actor::isPlaying() {
- return _isActionEnded;
+ return !_isActionEnded;
}
bool Actor::initPallete(Director *director) {
for (int i = 0; i < _actions.size(); ++i) {
if (_actions[i]->initPallete(director))
- break;
+ return true;
}
+ return false;
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/actor.h b/engines/pink/objects/actors/actor.h
index dd75183251..2dc9769275 100644
--- a/engines/pink/objects/actors/actor.h
+++ b/engines/pink/objects/actors/actor.h
@@ -59,6 +59,8 @@ public:
bool initPallete(Director *director);
+ void update() {};
+
protected:
GamePage *_page;
Action *_action;
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index 88c579c5c2..43e144be1f 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -50,6 +50,7 @@ void LeadActor::init(bool unk) {
_state = kReady;
}
_page->getModule()->getInventoryMgr()->setLeadActor(this);
+ _page->getGame()->setLeadActor(this);
Actor::init(unk);
}
@@ -64,6 +65,19 @@ LeadActor::State LeadActor::getState() const {
return _state;
}
+void LeadActor::update() {
+ switch (_state) {
+ case kPlayingVideo:
+ _sequencer->update();
+ if (!_sequencer->_context){
+ _state = kUnk_Loading;
+ _page->getGame()->changeScene(_page);
+ }
+ default:
+ break;
+ }
+}
+
void ParlSqPink::toConsole() {
debug("ParlSqPink: _name = %s", _name.c_str());
for (int i = 0; i < _actions.size(); ++i) {
diff --git a/engines/pink/objects/actors/lead_actor.h b/engines/pink/objects/actors/lead_actor.h
index 319c3f7deb..d7c45e02bd 100644
--- a/engines/pink/objects/actors/lead_actor.h
+++ b/engines/pink/objects/actors/lead_actor.h
@@ -54,6 +54,7 @@ public:
State getState() const;
void start(bool isHandler);
+ void update();
private:
State _state;
diff --git a/engines/pink/objects/module.cpp b/engines/pink/objects/module.cpp
index 97f78d4637..d1e16f37ee 100644
--- a/engines/pink/objects/module.cpp
+++ b/engines/pink/objects/module.cpp
@@ -22,6 +22,7 @@
#include "module.h"
#include "engines/pink/objects/pages/game_page.h"
+#include "pink/pink.h"
namespace Pink {
@@ -45,52 +46,36 @@ void Module::load(Archive &archive){
archive >> _pages;
}
-void Module::init(bool isLoadingSave, const Common::String *pageName) {
- // debugging original
+void Module::init(bool isLoadingSave, const Common::String &pageName) {
// 0 0 - new game
// 0 1 - module changed
// 1 0 - from save
-
- // 1 1 - haven't seen those values
-
- //this func will be rewrited after testing
-
- if (_page) {
- debug("loading from save");
- }
- if (pageName){
- debug("module changed");
- }
- assert(_pages.size() != 0);
-
- if (pageName) {
- uint i;
- for (i = 0; i < _pages.size(); ++i) {
- if(*pageName == _pages[i]->getName()) {
- _page = _pages[i];
- }
- }
- assert(i < _pages.size());
- }
-
- if (_page) {
- _page->init(isLoadingSave); // module changed or from save
- return;
+ if (!pageName.empty()) {
+ _page = findPage(pageName);
}
- if (_page != _pages[0]) {
- if (_page) {
- assert(0); // in original code there is call to page func but I've never seen it
- return;
- }
+ if (!_page)
_page = _pages[0];
- _page->init(isLoadingSave); // new game
- return;
- }
- assert(0);
+ _page->init(isLoadingSave);
+}
+
+void Module::changePage(const Common::String &pageName) {
+ GamePage *page = nullptr;
+ page = findPage(pageName);
+ assert(_page != page);
+ //_page->clear
+ page->init(kLoadingNewGame);
}
+GamePage *Module::findPage(const Common::String &pageName) const {
+ return *Common::find_if(_pages.begin(), _pages.end(), [&pageName]
+ (GamePage* page) {
+ return pageName == page->getName();
+ });
+}
+
+
PinkEngine *Module::getGame() const {
return _game;
}
diff --git a/engines/pink/objects/module.h b/engines/pink/objects/module.h
index 214ff2a473..959f886a83 100644
--- a/engines/pink/objects/module.h
+++ b/engines/pink/objects/module.h
@@ -45,13 +45,13 @@ public:
Module(PinkEngine *game, const Common::String &name);
void load(Archive &archive);
- void init(bool isLoadingSave, const Common::String *pageName);
+ void init(bool isLoadingSave, const Common::String &pageName);
+ void changePage(const Common::String &pageName);
void OnLeftButtonDown();
void OnMouseMove();
void OnKeyboardButtonClick();
-
PinkEngine *getGame() const;
InventoryMgr *getInventoryMgr();
@@ -59,6 +59,8 @@ public:
void setVariable(Common::String &variable, Common::String &value);
private:
+ GamePage *findPage(const Common::String &pageName) const;
+
PinkEngine *_game;
GamePage *_page;
Common::Array<GamePage*> _pages;
diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp
index 465b1fc1b8..5acc1f1858 100644
--- a/engines/pink/objects/pages/game_page.cpp
+++ b/engines/pink/objects/pages/game_page.cpp
@@ -64,27 +64,29 @@ void GamePage::init(bool isLoadingSave) {
break;
}
-
LeadActor::State state = _leadActor->getState();
- bool unk = (state == LeadActor::kInventory || state == LeadActor::kPDA);
+ bool startNow = !(state == LeadActor::kInventory || state == LeadActor::kPDA);
for (int i = 0; i < _actors.size(); ++i) {
- _actors[i]->init(unk);
+ _actors[i]->init(startNow);
}
- if (!isLoadingSave)
- initHandler();
-
+ bool isHandler = 0;
+ if (!isLoadingSave) {
+ isHandler = initHandler();
+ }
+ //_leadActor->start(isHandler);
}
-void GamePage::initHandler() {
+bool GamePage::initHandler() {
for (uint i = 0; i < _handlers.size(); ++i) {
if (_handlers[i]->isSuitable(_leadActor)){
_handlers[i]->onMessage(_leadActor);
- break;
+ return true;
}
}
+ return false;
}
void GamePage::loadManagers() {
diff --git a/engines/pink/objects/pages/game_page.h b/engines/pink/objects/pages/game_page.h
index 74d19766b7..94bff54200 100644
--- a/engines/pink/objects/pages/game_page.h
+++ b/engines/pink/objects/pages/game_page.h
@@ -53,7 +53,7 @@ public:
virtual void toConsole();
private:
- void initHandler();
+ bool initHandler();
int perhapsIsLoaded;
diff --git a/engines/pink/objects/sequences/sequence.cpp b/engines/pink/objects/sequences/sequence.cpp
index efc0c01ede..80f5c58e5b 100644
--- a/engines/pink/objects/sequences/sequence.cpp
+++ b/engines/pink/objects/sequences/sequence.cpp
@@ -69,17 +69,15 @@ void Sequence::init(int unk) {
start(unk);
}
-class Action;
-
void Sequence::start(int unk) {
- if (_context->_nextItemIndex > _items.size()){
- debug("Sequence %s ended", _name);
- //TODO destroy context
+ if (_context->_nextItemIndex >= _items.size()){
+ debug("Sequence %s ended", _name.c_str());
+ end();
return;
}
if (!_items[_context->_nextItemIndex]->execute(_context->_index, this, unk)){
- //destroy context;
+ assert(0);
}
uint i;
@@ -98,6 +96,19 @@ void Sequence::start(int unk) {
_context->_index++;
}
+void Sequence::update() {
+ if (!_context->_actor->isPlaying()){
+ debug("Sequence step ended");
+ start(0);
+ }
+}
+
+void Sequence::end() {
+ _context->_actor = 0;
+ _unk = 1;
+ _sequencer->removeContext(_context);
+}
+
void SequenceAudio::deserialize(Archive &archive) {
Sequence::deserialize(archive);
archive >> _sound;
diff --git a/engines/pink/objects/sequences/sequence.h b/engines/pink/objects/sequences/sequence.h
index 5fca545e66..3975acf915 100644
--- a/engines/pink/objects/sequences/sequence.h
+++ b/engines/pink/objects/sequences/sequence.h
@@ -45,7 +45,9 @@ public:
void setContext(SequenceContext *context);
void init(int unk);
void start(int unk);
+ void end();
+ void update();
public:
SequenceContext *_context;
diff --git a/engines/pink/objects/sequences/sequencer.cpp b/engines/pink/objects/sequences/sequencer.cpp
index 0667f2bfd2..fea28e5f52 100644
--- a/engines/pink/objects/sequences/sequencer.cpp
+++ b/engines/pink/objects/sequences/sequencer.cpp
@@ -25,6 +25,7 @@
#include "sequencer.h"
#include "sequence.h"
#include "sequence_context.h"
+#include "pink/objects/actors/actor.h"
#include "engines/pink/archive.h"
namespace Pink {
@@ -71,4 +72,13 @@ void Sequencer::toConsole() {
}
}
+void Sequencer::update() {
+ _context->_sequence->update();
+}
+
+void Sequencer::removeContext(SequenceContext *context) {
+ delete _context;
+ _context = 0;
+}
+
} // End of namespace Pink \ No newline at end of file
diff --git a/engines/pink/objects/sequences/sequencer.h b/engines/pink/objects/sequences/sequencer.h
index 36e9ba0c74..55e8529988 100644
--- a/engines/pink/objects/sequences/sequencer.h
+++ b/engines/pink/objects/sequences/sequencer.h
@@ -45,9 +45,14 @@ public:
Sequence* findSequence(const Common::String &name);
void authorSequence(Sequence *sequence, bool unk);
+ void removeContext(SequenceContext *context);
+
+ void update();
+
+
public:
SequenceContext *_context;
- // unknown objects array
+ // context array
Common::Array<Sequence*> _sequences;
Common::String _currentSequenceName;
Common::Array<SeqTimer*> _timers;
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index afcae8c593..4c5b7cef89 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -26,6 +26,7 @@
#include <common/debug-channels.h>
#include <video/flic_decoder.h>
#include "engines/pink/objects/module.h"
+#include "engines/pink/objects/actors/lead_actor.h"
#include <graphics/surface.h>
namespace Pink {
@@ -75,8 +76,8 @@ Common::Error PinkEngine::init() {
// TODO load cursor
_orb.loadGame(this);
- _nextModule = _modules[0]->getName();
- initModule();
+ const Common::String empty;
+ initModule(_modules[0]->getName(), kLoadingNewGame, empty);
return Common::kNoError;
}
@@ -88,7 +89,6 @@ Common::Error Pink::PinkEngine::run() {
}
- int i = 0;
while(!shouldQuit()){
Common::Event event;
while(_eventMan->pollEvent(event)){
@@ -104,18 +104,21 @@ Common::Error Pink::PinkEngine::run() {
break;
- // don't know why it is used in orginal
- case Common::EVENT_LBUTTONUP:
- case Common::EVENT_RBUTTONDOWN:
case Common::EVENT_KEYDOWN:
break;
+
+ // don't know why it is used in original
+ case Common::EVENT_LBUTTONUP:
+ case Common::EVENT_RBUTTONDOWN:
default:
break;
}
}
+ _actor->update();
+ _director.update();
_director.draw();
- _system->delayMillis(10);
+ _system->delayMillis(50);
}
return Common::kNoError;
@@ -127,20 +130,17 @@ void PinkEngine::load(Archive &archive) {
archive >> _modules;
}
-void PinkEngine::initModule() {
+void PinkEngine::initModule(const Common::String &moduleName, bool isLoadingFromSave, const Common::String &pageName) {
if (_module) {
- assert(_module->getName() != _nextModule);
//call module function (smth with unloading)
- //check additional field of game(unk_1)
uint i;
for (i = 0; i < _modules.size(); ++i) {
if (_module == _modules[i]){
break;
}
}
- assert(i != _modules.size());
_modules[i] = new ModuleProxy(_module->getName());
@@ -148,20 +148,26 @@ void PinkEngine::initModule() {
_module = nullptr;
}
- assert(_modules.size() != 0);
-
uint i;
for (i = 0; i < _modules.size(); ++i) {
- assert(dynamic_cast<Module*>(_modules[i]) == 0);
- if (_modules[i]->getName() == _nextModule) {
+ if (_modules[i]->getName() == moduleName) {
loadModule(i);
break;
}
}
- assert(i < _modules.size());
_module = static_cast<Module*>(_modules[i]);
- _module->init(LoadingNotSave, 0);
+ _module->init(isLoadingFromSave, pageName);
+}
+
+void PinkEngine::changeScene(GamePage *page) {
+ if (!_nextModule.empty() && _nextModule.compareTo(_module->getName())) {
+ initModule(_nextModule, kLoadingNewGame, _nextPage);
+ }
+ else {
+ assert(!_nextPage.empty());
+ _module->changePage(_nextPage);
+ }
}
@@ -171,8 +177,6 @@ void PinkEngine::setNextExecutors(const Common::String &nextModule, const Common
}
void PinkEngine::loadModule(int index) {
- assert(dynamic_cast<Module*>(_modules[index]) == 0);
-
Module *module = new Module(this, _modules[index]->getName());
_orb.loadObject(module, module->getName());
@@ -190,8 +194,4 @@ void PinkEngine::setVariable(Common::String &variable, Common::String &value) {
_variables[variable] = value;
}
-Common::RandomSource &PinkEngine::getRnd() {
- return _rnd;
-}
-
} \ No newline at end of file
diff --git a/engines/pink/pink.h b/engines/pink/pink.h
index f592a89e7e..591d288de4 100644
--- a/engines/pink/pink.h
+++ b/engines/pink/pink.h
@@ -49,6 +49,8 @@ class Console;
class Archive;
class NamedObject;
class Module;
+class GamePage;
+class LeadActor;
enum {
kPinkDebugGeneral = 1 << 0,
@@ -59,8 +61,8 @@ enum {
};
enum {
- LoadingSave = 1,
- LoadingNotSave = 0
+ kLoadingSave = 1,
+ kLoadingNewGame = 0
};
class PinkEngine : public Engine {
@@ -69,18 +71,21 @@ public:
~PinkEngine();
virtual Common::Error run();
- void load(Archive &archive);
- void initModule();
- void setNextExecutors(const Common::String &nextModule, const Common::String &nextPage);
+ void load(Archive &archive);
+ void initModule(const Common::String &moduleName, bool isLoadingFromSave, const Common::String &pageName);
+ void changeScene(GamePage *page);
OrbFile *getOrb() { return &_orb; }
BroFile *getBro() { return _bro; }
- Common::RandomSource &getRnd();
- Director *getDirector() { return &_director;}
+ Common::RandomSource &getRnd() { return _rnd; };
+ Director *getDirector() { return &_director; }
+
+ void setNextExecutors(const Common::String &nextModule, const Common::String &nextPage);
+ void setLeadActor(LeadActor *actor) { _actor = actor; };
- bool checkValueOfVariable(Common::String &variable, Common::String &value);
void setVariable(Common::String &variable, Common::String &value);
+ bool checkValueOfVariable(Common::String &variable, Common::String &value);
private:
Common::Error init();
@@ -96,6 +101,7 @@ private:
BroFile *_bro;
Director _director;
+ LeadActor *_actor;
Module *_module;
Common::Array<NamedObject*> _modules;