Skip to content

Commit

Permalink
PINK: game page init fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
whiterandrek authored and sev- committed Jun 28, 2018
1 parent be415cd commit eb6ce67
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 20 deletions.
12 changes: 8 additions & 4 deletions engines/pink/objects/actors/lead_actor.cpp
Expand Up @@ -39,15 +39,15 @@ void LeadActor::deserialize(Archive &archive) {
}

void LeadActor::setNextExecutors(Common::String &nextModule, Common::String &nextPage) {
if (_state == Ready || _state == Moving || _state == inDialog1 || _state == Inventory || _state == PDA) {
_state = PlayingVideo;
if (_state == kReady || _state == kMoving || _state == kInDialog1 || _state == kInventory || _state == kPDA) {
_state = kPlayingVideo;
_page->getGame()->setNextExecutors(nextModule, nextPage);
}
}

void LeadActor::init(bool unk) {
if (_state == unk_Loading){
_state = Ready;
if (_state == kUnk_Loading){
_state = kReady;
}
_page->getModule()->getInventoryMgr()->setLeadActor(this);
Actor::init(unk);
Expand All @@ -60,4 +60,8 @@ void LeadActor::toConsole() {
}
}

LeadActor::State LeadActor::getState() const {
return _state;
}

} // End of namespace Pink
18 changes: 10 additions & 8 deletions engines/pink/objects/actors/lead_actor.h
Expand Up @@ -34,14 +34,14 @@ class Sequencer;
class LeadActor : public Actor {
public:
enum State {
Ready = 0,
Moving,
inDialog1, //???
Inventory,
PDA,
inDialog2,//???
PlayingVideo, // ???
unk_Loading // ????
kReady = 0,
kMoving,
kInDialog1, //???
kInventory,
kPDA,
kInDialog2,//???
kPlayingVideo, // ???
kUnk_Loading // ????
};

virtual void deserialize(Archive &archive);
Expand All @@ -51,6 +51,8 @@ class LeadActor : public Actor {
void setNextExecutors (Common::String &nextModule, Common::String &nextPage);
virtual void init(bool unk);

State getState() const;

private:
State _state;
CursorMgr *_cursorMgr;
Expand Down
9 changes: 3 additions & 6 deletions engines/pink/objects/pages/game_page.cpp
Expand Up @@ -52,25 +52,22 @@ void GamePage::load(Archive &archive) {
}

void GamePage::init(bool isLoadingSave) {

if (!isLoadingSave){
//assert(perhapsIsLoaded == 0);
loadManagers();
}

toConsole();

for (int i = 0; i < _actors.size(); ++i) {
_actors[i]->init(0);
}
Page::init();

if (!isLoadingSave)
prepareHandler();
initHandler();


}

void GamePage::prepareHandler() {
void GamePage::initHandler() {
for (uint i = 0; i < _handlers.size(); ++i) {
if (_handlers[i]->isSuitable(_leadActor)){
_handlers[i]->init(_leadActor);
Expand Down
4 changes: 2 additions & 2 deletions engines/pink/objects/pages/game_page.h
Expand Up @@ -30,7 +30,7 @@ namespace Pink {
class CursorMgr;
class WalkMgr;
class Sequencer;
class Handler;
class HandlerStartPage;

class GamePage : public Page {
public:
Expand All @@ -53,7 +53,7 @@ class GamePage : public Page {
virtual void toConsole();

private:
void prepareHandler();
void initHandler();


int perhapsIsLoaded;
Expand Down
9 changes: 9 additions & 0 deletions engines/pink/objects/pages/page.cpp
Expand Up @@ -50,4 +50,13 @@ void Page::toConsole() {
}
}

void Page::init() {
LeadActor::State state = _leadActor->getState();
bool unk = (state == LeadActor::kInventory || state == LeadActor::kPDA);

for (int i = 0; i < _actors.size(); ++i) {
_actors[i]->init(unk);
}
}

} // End of namespace Pink
1 change: 1 addition & 0 deletions engines/pink/objects/pages/page.h
Expand Up @@ -43,6 +43,7 @@ class Page : public NamedObject {
virtual void toConsole();

protected:
void init();
Common::Array<Actor*> _actors;
ResourceMgr _resMgr;
LeadActor *_leadActor;
Expand Down

0 comments on commit eb6ce67

Please sign in to comment.