PINK: revised page initialization

This commit is contained in:
whiterandrek 2018-06-03 14:29:40 +03:00 committed by Eugene Sandulenko
parent 83799edcba
commit 44efa90377
5 changed files with 22 additions and 30 deletions

View File

@ -73,16 +73,12 @@ void GamePage::init(bool isLoadingSave) {
toConsole();
for (uint j = 0; j < _actors.size(); ++j) {
if (_actors[j]->initPallete(_module->getGame()->getDirector()))
break;
}
initPallete();
LeadActor::State state = _leadActor->getState();
bool startNow = !(state == LeadActor::kInventory || state == LeadActor::kPDA);
bool paused = (state == LeadActor::kInventory || state == LeadActor::kPDA);
for (uint i = 0; i < _actors.size(); ++i) {
_actors[i]->init(startNow);
_actors[i]->init(paused);
}
bool isHandler = false;

View File

@ -21,6 +21,7 @@
*/
#include "pink/director.h"
#include "pink/pink.h"
#include "pink/objects/actors/lead_actor.h"
#include "pink/objects/pages/page.h"
@ -63,11 +64,16 @@ void Page::toConsole() {
}
void Page::init() {
LeadActor::State state = _leadActor->getState();
bool unk = (state == LeadActor::kInventory || state == LeadActor::kPDA);
initPallete();
for (uint i = 0; i < _actors.size(); ++i) {
_actors[i]->init(unk);
_actors[i]->init(0);
}
}
void Page::initPallete() {
for (uint i = 0; i < _actors.size(); ++i) {
if (_actors[i]->initPallete(getGame()->getDirector()))
break;
}
}

View File

@ -40,6 +40,9 @@ public:
virtual void toConsole();
void load(Archive &archive);
void init();
void initPallete();
Actor *findActor(const Common::String &name);
LeadActor *getLeadActor();
@ -51,15 +54,14 @@ public:
PinkEngine *getGame();
virtual Sequencer *getSequencer() { return nullptr; };
virtual WalkMgr *getWalkMgr() { return nullptr;};
virtual Module *getModule() const { return nullptr; };
virtual Sequencer *getSequencer() { return nullptr; }
virtual WalkMgr *getWalkMgr() { return nullptr; }
virtual Module *getModule() const { return nullptr; }
virtual bool checkValueOfVariable(const Common::String &variable, const Common::String &value) { return 0; };
virtual void setVariable(Common::String &variable, Common::String &value) {};
virtual bool checkValueOfVariable(const Common::String &variable, const Common::String &value) { return 0; }
virtual void setVariable(Common::String &variable, Common::String &value) {}
protected:
void init();
Array<Actor *> _actors;
ResourceMgr _resMgr;

View File

@ -41,17 +41,6 @@ Array<Actor *> PDAPage::takeActors() {
return actorsCopy;
}
void PDAPage::init() {
for (uint i = 0; i < _actors.size(); ++i) {
if (_actors[i]->initPallete(_pdaMgr.getGame()->getDirector()))
break;
}
for (uint i = 0; i < _actors.size(); ++i) {
_actors[i]->init(0);
}
}
PDAPage::PDAPage(const Common::String &name, PDAMgr &pdaMgr)
: _pdaMgr(pdaMgr) {
_name = name;

View File

@ -32,9 +32,8 @@ class PDAMgr;
class PDAPage : public Page {
public:
static PDAPage create(const Common::String &pageName, PDAMgr &pdaMgr);
Array<Actor *> takeActors();
void init();
private:
PDAPage(const Common::String &name, PDAMgr &pdaMgr);
PDAMgr &_pdaMgr;