aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorwhiterandrek2018-05-22 08:03:37 +0300
committerEugene Sandulenko2018-06-28 23:51:32 +0200
commit82974a9ce37aba6240f7c3543947631170f012c2 (patch)
tree6aeed5f5edfb1c758b2c18b8ac224bde40eaff8c /engines
parent931d6adbcbbe063857814dc76886e9a967b2a4f3 (diff)
downloadscummvm-rg350-82974a9ce37aba6240f7c3543947631170f012c2.tar.gz
scummvm-rg350-82974a9ce37aba6240f7c3543947631170f012c2.tar.bz2
scummvm-rg350-82974a9ce37aba6240f7c3543947631170f012c2.zip
PINK: fix indentation
Diffstat (limited to 'engines')
-rw-r--r--engines/pink/archive.cpp440
-rw-r--r--engines/pink/archive.h36
-rw-r--r--engines/pink/cel_decoder.cpp256
-rw-r--r--engines/pink/cel_decoder.h60
-rw-r--r--engines/pink/console.h4
-rw-r--r--engines/pink/constants.h178
-rw-r--r--engines/pink/cursor_mgr.cpp136
-rw-r--r--engines/pink/cursor_mgr.h28
-rw-r--r--engines/pink/detection.cpp44
-rw-r--r--engines/pink/detection_tables.h48
-rw-r--r--engines/pink/director.cpp150
-rw-r--r--engines/pink/director.h30
-rw-r--r--engines/pink/file.cpp136
-rw-r--r--engines/pink/file.h52
-rw-r--r--engines/pink/module.mk74
-rw-r--r--engines/pink/objects/actions/action.cpp4
-rw-r--r--engines/pink/objects/actions/action.h20
-rw-r--r--engines/pink/objects/actions/action_cel.cpp50
-rw-r--r--engines/pink/objects/actions/action_cel.h30
-rw-r--r--engines/pink/objects/actions/action_hide.cpp10
-rw-r--r--engines/pink/objects/actions/action_hide.h10
-rw-r--r--engines/pink/objects/actions/action_loop.cpp54
-rw-r--r--engines/pink/objects/actions/action_loop.h22
-rw-r--r--engines/pink/objects/actions/action_play.cpp32
-rw-r--r--engines/pink/objects/actions/action_play.h12
-rw-r--r--engines/pink/objects/actions/action_play_with_sfx.cpp92
-rw-r--r--engines/pink/objects/actions/action_play_with_sfx.h38
-rw-r--r--engines/pink/objects/actions/action_sound.cpp64
-rw-r--r--engines/pink/objects/actions/action_sound.h28
-rw-r--r--engines/pink/objects/actions/action_still.cpp26
-rw-r--r--engines/pink/objects/actions/action_still.h10
-rw-r--r--engines/pink/objects/actions/action_talk.cpp44
-rw-r--r--engines/pink/objects/actions/action_talk.h18
-rw-r--r--engines/pink/objects/actions/action_text.cpp20
-rw-r--r--engines/pink/objects/actions/action_text.h16
-rw-r--r--engines/pink/objects/actions/walk_action.cpp12
-rw-r--r--engines/pink/objects/actions/walk_action.h8
-rw-r--r--engines/pink/objects/actors/actor.cpp122
-rw-r--r--engines/pink/objects/actors/actor.h62
-rw-r--r--engines/pink/objects/actors/audio_info_pda_button.h28
-rw-r--r--engines/pink/objects/actors/cursor_actor.h12
-rw-r--r--engines/pink/objects/actors/inventory_actor.h16
-rw-r--r--engines/pink/objects/actors/lead_actor.cpp554
-rw-r--r--engines/pink/objects/actors/lead_actor.h102
-rw-r--r--engines/pink/objects/actors/pda_button_actor.cpp16
-rw-r--r--engines/pink/objects/actors/pda_button_actor.h16
-rw-r--r--engines/pink/objects/actors/supporting_actor.cpp58
-rw-r--r--engines/pink/objects/actors/supporting_actor.h32
-rw-r--r--engines/pink/objects/condition.cpp40
-rw-r--r--engines/pink/objects/condition.h48
-rw-r--r--engines/pink/objects/handlers/handler.cpp158
-rw-r--r--engines/pink/objects/handlers/handler.h44
-rw-r--r--engines/pink/objects/handlers/handler_mgr.cpp130
-rw-r--r--engines/pink/objects/handlers/handler_mgr.h28
-rw-r--r--engines/pink/objects/handlers/handler_timer.cpp100
-rw-r--r--engines/pink/objects/handlers/handler_timer.h14
-rw-r--r--engines/pink/objects/inventory.cpp192
-rw-r--r--engines/pink/objects/inventory.h76
-rw-r--r--engines/pink/objects/module.cpp62
-rw-r--r--engines/pink/objects/module.h40
-rw-r--r--engines/pink/objects/object.cpp6
-rw-r--r--engines/pink/objects/object.h24
-rw-r--r--engines/pink/objects/pages/game_page.cpp196
-rw-r--r--engines/pink/objects/pages/game_page.h52
-rw-r--r--engines/pink/objects/pages/page.cpp54
-rw-r--r--engines/pink/objects/pages/page.h28
-rw-r--r--engines/pink/objects/sequences/seq_timer.cpp24
-rw-r--r--engines/pink/objects/sequences/seq_timer.h18
-rw-r--r--engines/pink/objects/sequences/sequence.cpp174
-rw-r--r--engines/pink/objects/sequences/sequence.h60
-rw-r--r--engines/pink/objects/sequences/sequence_context.cpp66
-rw-r--r--engines/pink/objects/sequences/sequence_context.h34
-rw-r--r--engines/pink/objects/sequences/sequence_item.cpp56
-rw-r--r--engines/pink/objects/sequences/sequence_item.h42
-rw-r--r--engines/pink/objects/sequences/sequencer.cpp94
-rw-r--r--engines/pink/objects/sequences/sequencer.h36
-rw-r--r--engines/pink/objects/side_effect.cpp70
-rw-r--r--engines/pink/objects/side_effect.h64
-rw-r--r--engines/pink/objects/walk/walk_location.cpp14
-rw-r--r--engines/pink/objects/walk/walk_location.h8
-rw-r--r--engines/pink/objects/walk/walk_mgr.cpp136
-rw-r--r--engines/pink/objects/walk/walk_mgr.h54
-rw-r--r--engines/pink/objects/walk/walk_shortest_path.cpp192
-rw-r--r--engines/pink/objects/walk/walk_shortest_path.h38
-rw-r--r--engines/pink/pink.cpp312
-rw-r--r--engines/pink/pink.h72
-rw-r--r--engines/pink/resource_mgr.cpp48
-rw-r--r--engines/pink/resource_mgr.h26
-rw-r--r--engines/pink/sound.cpp44
-rw-r--r--engines/pink/sound.h24
90 files changed, 3154 insertions, 3154 deletions
diff --git a/engines/pink/archive.cpp b/engines/pink/archive.cpp
index caaca5f749..36eda115b7 100644
--- a/engines/pink/archive.cpp
+++ b/engines/pink/archive.cpp
@@ -49,257 +49,257 @@
namespace Pink {
static const struct RuntimeClass {
- const char *name;
- int id;
+ const char *name;
+ int id;
} classMap[] = {
- {"ActionHide", kActionHide},
- {"ActionLoop", kActionLoop},
- {"ActionPlay", kActionPlay},
- {"ActionPlayWithSfx", kActionPlayWithSfx},
- {"ActionSfx", kActionSfx},
- {"ActionSound", kActionSound},
- {"ActionStill", kActionStill},
- {"ActionTalk", kActionTalk},
- {"ActionText", kActionText},
- {"Actor", kActor},
- {"AudioInfoPDAButton", kAudioInfoPDAButton},
- {"ConditionGameVariable", kConditionGameVariable},
- {"ConditionInventoryItemOwner", kConditionInventoryItemOwner},
- {"ConditionModuleVariable", kConditionModuleVariable},
- {"ConditionNotInventoryItemOwner", kConditionNotInventoryItemOwner},
- {"ConditionNotModuleVariable", kConditionNotModuleVariable},
- {"ConditionNotPageVariable", kConditionNotPageVariable},
- {"ConditionPageVariable", kConditionPageVariable},
- {"CursorActor", kCursorActor},
- {"GamePage", kGamePage},
- {"HandlerLeftClick", kHandlerLeftClick},
- {"HandlerStartPage", kHandlerStartPage},
- {"HandlerTimer", kHandlerTimer},
- {"HandlerTimerActions", kHandlerTimerActions},
- {"HandlerTimerSequences", kHandlerTimerSequences},
- {"HandlerUseClick", kHandlerUseClick},
- {"InventoryActor", kInventoryActor},
- {"InventoryItem", kInventoryItem},
- {"LeadActor", kLeadActor},
- {"ModuleProxy", kModuleProxy},
- {"PDAButtonActor", kPDAButtonActor},
- {"ParlSqPink", kParlSqPink},
- {"PubPink", kPubPink},
- {"SeqTimer", kSeqTimer},
- {"Sequence", kSequence},
- {"SequenceAudio", kSequenceAudio},
- {"SequenceItem", kSequenceItem},
- {"SequenceItemDefaultAction", kSequenceItemDefaultAction},
- {"SequenceItemLeader", kSequenceItemLeader},
- {"SequenceItemLeaderAudio", kSequenceItemLeaderAudio},
- {"SideEffectExit", kSideEffectExit},
- {"SideEffectGameVariable", kSideEffectGameVariable},
- {"SideEffectInventoryItemOwner", kSideEffectInventoryItemOwner},
- {"SideEffectLocation", kSideEffectLocation},
- {"SideEffectModuleVariable", kSideEffectModuleVariable},
- {"SideEffectPageVariable", kSideEffectPageVariable},
- {"SideEffectRandomPageVariable", kSideEffectRandomPageVariable},
- {"SupportingActor", kSupportingActor},
- {"WalkAction", kWalkAction},
- {"WalkLocation", kWalkLocation}
+ {"ActionHide", kActionHide},
+ {"ActionLoop", kActionLoop},
+ {"ActionPlay", kActionPlay},
+ {"ActionPlayWithSfx", kActionPlayWithSfx},
+ {"ActionSfx", kActionSfx},
+ {"ActionSound", kActionSound},
+ {"ActionStill", kActionStill},
+ {"ActionTalk", kActionTalk},
+ {"ActionText", kActionText},
+ {"Actor", kActor},
+ {"AudioInfoPDAButton", kAudioInfoPDAButton},
+ {"ConditionGameVariable", kConditionGameVariable},
+ {"ConditionInventoryItemOwner", kConditionInventoryItemOwner},
+ {"ConditionModuleVariable", kConditionModuleVariable},
+ {"ConditionNotInventoryItemOwner", kConditionNotInventoryItemOwner},
+ {"ConditionNotModuleVariable", kConditionNotModuleVariable},
+ {"ConditionNotPageVariable", kConditionNotPageVariable},
+ {"ConditionPageVariable", kConditionPageVariable},
+ {"CursorActor", kCursorActor},
+ {"GamePage", kGamePage},
+ {"HandlerLeftClick", kHandlerLeftClick},
+ {"HandlerStartPage", kHandlerStartPage},
+ {"HandlerTimer", kHandlerTimer},
+ {"HandlerTimerActions", kHandlerTimerActions},
+ {"HandlerTimerSequences", kHandlerTimerSequences},
+ {"HandlerUseClick", kHandlerUseClick},
+ {"InventoryActor", kInventoryActor},
+ {"InventoryItem", kInventoryItem},
+ {"LeadActor", kLeadActor},
+ {"ModuleProxy", kModuleProxy},
+ {"PDAButtonActor", kPDAButtonActor},
+ {"ParlSqPink", kParlSqPink},
+ {"PubPink", kPubPink},
+ {"SeqTimer", kSeqTimer},
+ {"Sequence", kSequence},
+ {"SequenceAudio", kSequenceAudio},
+ {"SequenceItem", kSequenceItem},
+ {"SequenceItemDefaultAction", kSequenceItemDefaultAction},
+ {"SequenceItemLeader", kSequenceItemLeader},
+ {"SequenceItemLeaderAudio", kSequenceItemLeaderAudio},
+ {"SideEffectExit", kSideEffectExit},
+ {"SideEffectGameVariable", kSideEffectGameVariable},
+ {"SideEffectInventoryItemOwner", kSideEffectInventoryItemOwner},
+ {"SideEffectLocation", kSideEffectLocation},
+ {"SideEffectModuleVariable", kSideEffectModuleVariable},
+ {"SideEffectPageVariable", kSideEffectPageVariable},
+ {"SideEffectRandomPageVariable", kSideEffectRandomPageVariable},
+ {"SupportingActor", kSupportingActor},
+ {"WalkAction", kWalkAction},
+ {"WalkLocation", kWalkLocation}
};
static Object* createObject(int objectId){
- switch (objectId){
- case kActionHide:
- return new ActionHide;
- case kActionLoop:
- return new ActionLoop;
- case kActionPlay:
- return new ActionPlay;
- case kActionPlayWithSfx:
- return new ActionPlayWithSfx;
- case kActionSfx:
- return new ActionSfx;
- case kActionSound:
- return new ActionSound;
- case kActionStill:
- return new ActionStill;
- case kActionTalk:
- return new ActionTalk;
- case kActionText:
- return new ActionText;
- case kActor:
- return new Actor;
- case kAudioInfoPDAButton:
- return new AudioInfoPDAButton;
- case kConditionGameVariable:
- return new ConditionGameVariable;
- case kConditionInventoryItemOwner:
- return new ConditionInventoryItemOwner;
- case kConditionModuleVariable:
- return new ConditionModuleVariable;
- case kConditionNotInventoryItemOwner:
- return new ConditionNotInventoryItemOwner;
- case kConditionNotModuleVariable:
- return new ConditionNotModuleVariable;
- case kConditionNotPageVariable:
- return new ConditionNotPageVariable;
- case kConditionPageVariable:
- return new ConditionPageVariable;
- case kCursorActor:
- return new CursorActor;
- case kGamePage:
- return new GamePage;
- case kHandlerLeftClick:
- return new HandlerLeftClick;
- case kHandlerStartPage:
- return new HandlerStartPage;
- case kHandlerTimer:
- case kHandlerTimerActions:
- return new HandlerTimerActions; // hack for Peril, but behavior is correct
- case kHandlerTimerSequences:
- return new HandlerTimerSequences;
- case kHandlerUseClick:
- return new HandlerUseClick;
- case kInventoryActor:
- return new InventoryActor;
- case kInventoryItem:
- return new InventoryItem;
- case kLeadActor:
- return new LeadActor;
- case kModuleProxy:
- return new ModuleProxy;
- case kPDAButtonActor:
- return new PDAButtonActor;
- case kParlSqPink:
- return new ParlSqPink;
- case kPubPink:
- return new PubPink;
- case kSeqTimer:
- return new SeqTimer;
- case kSequence:
- return new Sequence;
- case kSequenceAudio:
- return new SequenceAudio;
- case kSequenceItem:
- return new SequenceItem;
- case kSequenceItemDefaultAction:
- return new SequenceItemDefaultAction;
- case kSequenceItemLeader:
- return new SequenceItemLeader;
- case kSequenceItemLeaderAudio:
- return new SequenceItemLeaderAudio;
- case kSideEffectExit:
- return new SideEffectExit;
- case kSideEffectGameVariable:
- return new SideEffectGameVariable;
- case kSideEffectInventoryItemOwner:
- return new SideEffectInventoryItemOwner;
- case kSideEffectLocation:
- return new SideEffectLocation;
- case kSideEffectModuleVariable:
- return new SideEffectModuleVariable;
- case kSideEffectPageVariable:
- return new SideEffectPageVariable;
- case kSideEffectRandomPageVariable:
- return new SideEffectRandomPageVariable;
- case kSupportingActor:
- return new SupportingActor;
- case kWalkAction:
- return new WalkAction;
- case kWalkLocation:
- return new WalkLocation;
- default:
- error("Unknown object id");
- return nullptr;
- }
+ switch (objectId){
+ case kActionHide:
+ return new ActionHide;
+ case kActionLoop:
+ return new ActionLoop;
+ case kActionPlay:
+ return new ActionPlay;
+ case kActionPlayWithSfx:
+ return new ActionPlayWithSfx;
+ case kActionSfx:
+ return new ActionSfx;
+ case kActionSound:
+ return new ActionSound;
+ case kActionStill:
+ return new ActionStill;
+ case kActionTalk:
+ return new ActionTalk;
+ case kActionText:
+ return new ActionText;
+ case kActor:
+ return new Actor;
+ case kAudioInfoPDAButton:
+ return new AudioInfoPDAButton;
+ case kConditionGameVariable:
+ return new ConditionGameVariable;
+ case kConditionInventoryItemOwner:
+ return new ConditionInventoryItemOwner;
+ case kConditionModuleVariable:
+ return new ConditionModuleVariable;
+ case kConditionNotInventoryItemOwner:
+ return new ConditionNotInventoryItemOwner;
+ case kConditionNotModuleVariable:
+ return new ConditionNotModuleVariable;
+ case kConditionNotPageVariable:
+ return new ConditionNotPageVariable;
+ case kConditionPageVariable:
+ return new ConditionPageVariable;
+ case kCursorActor:
+ return new CursorActor;
+ case kGamePage:
+ return new GamePage;
+ case kHandlerLeftClick:
+ return new HandlerLeftClick;
+ case kHandlerStartPage:
+ return new HandlerStartPage;
+ case kHandlerTimer:
+ case kHandlerTimerActions:
+ return new HandlerTimerActions; // hack for Peril, but behavior is correct
+ case kHandlerTimerSequences:
+ return new HandlerTimerSequences;
+ case kHandlerUseClick:
+ return new HandlerUseClick;
+ case kInventoryActor:
+ return new InventoryActor;
+ case kInventoryItem:
+ return new InventoryItem;
+ case kLeadActor:
+ return new LeadActor;
+ case kModuleProxy:
+ return new ModuleProxy;
+ case kPDAButtonActor:
+ return new PDAButtonActor;
+ case kParlSqPink:
+ return new ParlSqPink;
+ case kPubPink:
+ return new PubPink;
+ case kSeqTimer:
+ return new SeqTimer;
+ case kSequence:
+ return new Sequence;
+ case kSequenceAudio:
+ return new SequenceAudio;
+ case kSequenceItem:
+ return new SequenceItem;
+ case kSequenceItemDefaultAction:
+ return new SequenceItemDefaultAction;
+ case kSequenceItemLeader:
+ return new SequenceItemLeader;
+ case kSequenceItemLeaderAudio:
+ return new SequenceItemLeaderAudio;
+ case kSideEffectExit:
+ return new SideEffectExit;
+ case kSideEffectGameVariable:
+ return new SideEffectGameVariable;
+ case kSideEffectInventoryItemOwner:
+ return new SideEffectInventoryItemOwner;
+ case kSideEffectLocation:
+ return new SideEffectLocation;
+ case kSideEffectModuleVariable:
+ return new SideEffectModuleVariable;
+ case kSideEffectPageVariable:
+ return new SideEffectPageVariable;
+ case kSideEffectRandomPageVariable:
+ return new SideEffectRandomPageVariable;
+ case kSupportingActor:
+ return new SupportingActor;
+ case kWalkAction:
+ return new WalkAction;
+ case kWalkLocation:
+ return new WalkLocation;
+ default:
+ error("Unknown object id");
+ return nullptr;
+ }
}
Archive::Archive(Common::SeekableReadStream *stream)
- : _readStream(stream), _writeStream(nullptr)
+ : _readStream(stream), _writeStream(nullptr)
{
- _objectMap.push_back(0);
- _objectIdMap.push_back(kNullObject);
+ _objectMap.push_back(0);
+ _objectIdMap.push_back(kNullObject);
}
Archive::Archive(Common::WriteStream *stream)
- : _writeStream(stream), _readStream(nullptr)
+ : _writeStream(stream), _readStream(nullptr)
{
- _objectMap.push_back(0);
- _objectIdMap.push_back(kNullObject);
+ _objectMap.push_back(0);
+ _objectIdMap.push_back(kNullObject);
}
Archive::~Archive()
{}
void Archive::mapObject(Object *obj) {
- _objectMap.push_back(obj);
- _objectIdMap.push_back(0);
+ _objectMap.push_back(obj);
+ _objectIdMap.push_back(0);
}
int Archive::readCount() {
- int count = _readStream->readUint16LE();
+ int count = _readStream->readUint16LE();
- if (count == 0xffff)
- count = _readStream->readUint32LE();
+ if (count == 0xffff)
+ count = _readStream->readUint32LE();
- return count;
+ return count;
}
Object *Archive::readObject() {
- bool isCopyReturned;
- Object *res = parseObject(isCopyReturned);
+ bool isCopyReturned;
+ Object *res = parseObject(isCopyReturned);
- if (res && !isCopyReturned) {
- res->deserialize(*this);
- }
+ if (res && !isCopyReturned) {
+ res->deserialize(*this);
+ }
- return res;
+ return res;
}
Object *Archive::parseObject(bool &isCopyReturned) {
- char className[kMaxClassLength];
- int objectId = 0;
- Object *res = nullptr;
+ char className[kMaxClassLength];
+ int objectId = 0;
+ Object *res = nullptr;
- uint obTag = _readStream->readUint16LE();
+ uint obTag = _readStream->readUint16LE();
- if (obTag == 0x0000) {
- return nullptr;
- } else if (obTag == 0xffff) {
- int schema = _readStream->readUint16LE();
+ if (obTag == 0x0000) {
+ return nullptr;
+ } else if (obTag == 0xffff) {
+ int schema = _readStream->readUint16LE();
- int size = _readStream->readUint16LE();
- _readStream->read(className, size);
- className[size] = '\0';
+ int size = _readStream->readUint16LE();
+ _readStream->read(className, size);
+ className[size] = '\0';
- objectId = findObjectId(className + 1);
+ objectId = findObjectId(className + 1);
- res = createObject(objectId);
- if (!res) error("Class %s is not implemented", className);
+ res = createObject(objectId);
+ if (!res) error("Class %s is not implemented", className);
- _objectMap.push_back(res);
- _objectIdMap.push_back(objectId);
+ _objectMap.push_back(res);
+ _objectIdMap.push_back(objectId);
- _objectMap.push_back(res); // Basically a hack, but behavior is all correct
- _objectIdMap.push_back(objectId);
+ _objectMap.push_back(res); // Basically a hack, but behavior is all correct
+ _objectIdMap.push_back(objectId);
- isCopyReturned = false;
- } else if ((obTag & 0x8000) == 0) {
+ isCopyReturned = false;
+ } else if ((obTag & 0x8000) == 0) {
- res = _objectMap[obTag];
+ res = _objectMap[obTag];
- isCopyReturned = true;
- } else {
+ isCopyReturned = true;
+ } else {
- obTag &= ~0x8000;
+ obTag &= ~0x8000;
- objectId = _objectIdMap[obTag];
+ objectId = _objectIdMap[obTag];
- res = createObject(objectId);
- _objectMap.push_back(res);
- _objectIdMap.push_back(objectId);
+ res = createObject(objectId);
+ _objectMap.push_back(res);
+ _objectIdMap.push_back(objectId);
- isCopyReturned = false;
- }
+ isCopyReturned = false;
+ }
- return res;
+ return res;
}
static int runtimeClassCmp(const void *key, const void *elem) {
@@ -307,41 +307,41 @@ static int runtimeClassCmp(const void *key, const void *elem) {
}
uint Archive::findObjectId(const char *name) {
- RuntimeClass *found = (RuntimeClass*) bsearch(name, classMap, sizeof(classMap) / sizeof(RuntimeClass) , sizeof(RuntimeClass), runtimeClassCmp);
+ RuntimeClass *found = (RuntimeClass*) bsearch(name, classMap, sizeof(classMap) / sizeof(RuntimeClass) , sizeof(RuntimeClass), runtimeClassCmp);
- if (!found)
- error("Class %s is not in class Map", name);
+ if (!found)
+ error("Class %s is not in class Map", name);
- return found->id;
+ return found->id;
}
Common::String Archive::readString() {
- char buffer[kMaxStringLength];
- byte len = _readStream->readByte();
- assert(len <= kMaxStringLength);
- _readStream->read(buffer, len);
- return Common::String(buffer, len);
+ char buffer[kMaxStringLength];
+ byte len = _readStream->readByte();
+ assert(len <= kMaxStringLength);
+ _readStream->read(buffer, len);
+ return Common::String(buffer, len);
}
uint32 Archive::readDWORD() {
- return _readStream->readUint32LE();
+ return _readStream->readUint32LE();
}
uint16 Archive::readWORD() {
- return _readStream->readUint16LE();
+ return _readStream->readUint16LE();
}
void Archive::writeDWORD(uint32 val) {
- _writeStream->writeUint32LE(val);
+ _writeStream->writeUint32LE(val);
}
void Archive::writeWORD(uint16 val) {
- _writeStream->writeUint16LE(val);
+ _writeStream->writeUint16LE(val);
}
void Archive::writeString(const Common::String &string) {
- _writeStream->writeByte(string.size());
- _writeStream->write(string.c_str(), string.size());
+ _writeStream->writeByte(string.size());
+ _writeStream->write(string.c_str(), string.size());
}
} // End of namespace Pink
diff --git a/engines/pink/archive.h b/engines/pink/archive.h
index e9369877a5..552b2bc4ca 100644
--- a/engines/pink/archive.h
+++ b/engines/pink/archive.h
@@ -39,32 +39,32 @@ namespace Pink {
class Archive {
public:
- Archive(Common::SeekableReadStream *stream);
- Archive(Common::WriteStream *stream);
- ~Archive();
+ Archive(Common::SeekableReadStream *stream);
+ Archive(Common::WriteStream *stream);
+ ~Archive();
- void mapObject(Object *obj);
+ void mapObject(Object *obj);
- int readCount();
- uint32 readDWORD();
- uint16 readWORD();
+ int readCount();
+ uint32 readDWORD();
+ uint16 readWORD();
- void writeDWORD(uint32 val);
- void writeWORD(uint16 val);
+ void writeDWORD(uint32 val);
+ void writeWORD(uint16 val);
- Object *readObject();
- Common::String readString();
- void writeString(const Common::String &string);
+ Object *readObject();
+ Common::String readString();
+ void writeString(const Common::String &string);
private:
- uint findObjectId(const char *name);
+ uint findObjectId(const char *name);
- Object *parseObject(bool &isCopyReturned);
+ Object *parseObject(bool &isCopyReturned);
- Common::Array<Object *> _objectMap;
- Common::Array<uint> _objectIdMap;
- Common::SeekableReadStream *_readStream;
- Common::WriteStream *_writeStream;
+ Common::Array<Object *> _objectMap;
+ Common::Array<uint> _objectIdMap;
+ Common::SeekableReadStream *_readStream;
+ Common::WriteStream *_writeStream;
};
} // End of namespace Pink
diff --git a/engines/pink/cel_decoder.cpp b/engines/pink/cel_decoder.cpp
index 044a8d00b2..0387873618 100644
--- a/engines/pink/cel_decoder.cpp
+++ b/engines/pink/cel_decoder.cpp
@@ -29,224 +29,224 @@
namespace Pink {
bool CelDecoder::loadStream(Common::SeekableReadStream *stream) {
- close();
+ close();
- /* uint32 frameSize = */ stream->readUint32LE();
- uint16 frameType = stream->readUint16LE();
+ /* uint32 frameSize = */ stream->readUint32LE();
+ uint16 frameType = stream->readUint16LE();
- // Check FLC magic number
- if (frameType != 0xAF12) {
- warning("FlicDecoder::loadStream(): attempted to load non-FLC data (type = 0x%04X)", frameType);
- return false;
- }
+ // Check FLC magic number
+ if (frameType != 0xAF12) {
+ warning("FlicDecoder::loadStream(): attempted to load non-FLC data (type = 0x%04X)", frameType);
+ return false;
+ }
- uint16 frameCount = stream->readUint16LE();
- uint16 width = stream->readUint16LE();
- uint16 height = stream->readUint16LE();
- uint16 colorDepth = stream->readUint16LE();
- if (colorDepth != 8) {
- warning("FlicDecoder::loadStream(): attempted to load an FLC with a palette of color depth %d. Only 8-bit color palettes are supported", colorDepth);
- return false;
- }
+ uint16 frameCount = stream->readUint16LE();
+ uint16 width = stream->readUint16LE();
+ uint16 height = stream->readUint16LE();
+ uint16 colorDepth = stream->readUint16LE();
+ if (colorDepth != 8) {
+ warning("FlicDecoder::loadStream(): attempted to load an FLC with a palette of color depth %d. Only 8-bit color palettes are supported", colorDepth);
+ return false;
+ }
- addTrack(new CelVideoTrack(stream, frameCount, width, height));
- return true;
+ addTrack(new CelVideoTrack(stream, frameCount, width, height));
+ return true;
}
int32 CelDecoder::getX(){
- CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
- if (!track)
- return -1;
- return track->getX();
+ CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
+ if (!track)
+ return -1;
+ return track->getX();
}
int32 CelDecoder::getY() {
- CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
- if (!track)
- return -1;
- return track->getY();
+ CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
+ if (!track)
+ return -1;
+ return track->getY();
}
uint16 CelDecoder::getTransparentColourIndex() {
- CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
- if (!track)
- return 0;
- return track->getTransparentColourIndex();
+ CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
+ if (!track)
+ return 0;
+ return track->getTransparentColourIndex();
}
const Graphics::Surface *CelDecoder::getCurrentFrame() {
- CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
- if (!track)
- return 0;
- return track->getCurrentFrame();
+ CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
+ if (!track)
+ return 0;
+ return track->getCurrentFrame();
}
Common::Point CelDecoder::getCenter() {
- CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
- if (!track)
- return {0,0};
- return track->getCenter();
+ CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
+ if (!track)
+ return {0,0};
+ return track->getCenter();
}
Common::Rect &CelDecoder::getRectangle() {
- CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
- return track->getRect();
+ CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
+ return track->getRect();
}
void CelDecoder::setX(int32 x) {
- CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
- track->setX(x);
+ CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
+ track->setX(x);
}
void CelDecoder::setY(int32 y) {
- CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
- track->setY(y);
+ CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
+ track->setY(y);
}
void CelDecoder::skipFrame() {
- CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
- track->skipFrame();
+ CelVideoTrack *track = (CelVideoTrack*) getTrack(0);
+ track->skipFrame();
}
CelDecoder::CelVideoTrack::CelVideoTrack(Common::SeekableReadStream *stream, uint16 frameCount, uint16 width, uint16 height, bool skipHeader)
- : FlicVideoTrack(stream, frameCount, width, height, 1), _center(0,0), _transparentColourIndex(0){
- readHeader();
+ : FlicVideoTrack(stream, frameCount, width, height, 1), _center(0,0), _transparentColourIndex(0){
+ readHeader();
}
#define PREFIX_TYPE 0xF100
#define CEL_DATA 3
void CelDecoder::CelVideoTrack::readPrefixChunk() {
- _fileStream->seek(0x80);
- uint32 chunkSize = _fileStream->readUint32LE();
- uint16 chunkType = _fileStream->readUint16LE();
- if (chunkType != PREFIX_TYPE)
- return;
- uint32 offset = 6;
-
- uint32 subchunkSize = _fileStream->readUint32LE();
- uint16 subchunkType = _fileStream->readUint16LE();
-
- switch (subchunkType) {
- case CEL_DATA:
- _fileStream->readUint16LE();
- _center.x = _fileStream->readUint16LE();
- _center.y = _fileStream->readUint16LE();
- break;
- default:
- error("Unknown subchunk type");
- _fileStream->skip(subchunkSize - 6);
- break;
- }
- _rect = Common::Rect::center(_center.x, _center.y, _surface->w, _surface->h);
+ _fileStream->seek(0x80);
+ uint32 chunkSize = _fileStream->readUint32LE();
+ uint16 chunkType = _fileStream->readUint16LE();
+ if (chunkType != PREFIX_TYPE)
+ return;
+ uint32 offset = 6;
+
+ uint32 subchunkSize = _fileStream->readUint32LE();
+ uint16 subchunkType = _fileStream->readUint16LE();
+
+ switch (subchunkType) {
+ case CEL_DATA:
+ _fileStream->readUint16LE();
+ _center.x = _fileStream->readUint16LE();
+ _center.y = _fileStream->readUint16LE();
+ break;
+ default:
+ error("Unknown subchunk type");
+ _fileStream->skip(subchunkSize - 6);
+ break;
+ }
+ _rect = Common::Rect::center(_center.x, _center.y, _surface->w, _surface->h);
}
void CelDecoder::CelVideoTrack::readHeader() {
- _fileStream->readUint16LE();
+ _fileStream->readUint16LE();
- _frameDelay = _startFrameDelay = _fileStream->readUint32LE();
+ _frameDelay = _startFrameDelay = _fileStream->readUint32LE();
- _fileStream->seek(80);
- _offsetFrame1 = _fileStream->readUint32LE();
- _offsetFrame2 = _fileStream->readUint32LE();
+ _fileStream->seek(80);
+ _offsetFrame1 = _fileStream->readUint32LE();
+ _offsetFrame2 = _fileStream->readUint32LE();
- if (_offsetFrame1 > 0x80) {
- readPrefixChunk();
- }
+ if (_offsetFrame1 > 0x80) {
+ readPrefixChunk();
+ }
- _fileStream->seek(_offsetFrame1);
+ _fileStream->seek(_offsetFrame1);
}
int32 CelDecoder::CelVideoTrack::getX() const {
- return (_center.x - getWidth() / 2) < 0 ? 0 : _center.x - getWidth() / 2;
+ return (_center.x - getWidth() / 2) < 0 ? 0 : _center.x - getWidth() / 2;
}
int32 CelDecoder::CelVideoTrack::getY() const {
- return (_center.y - getHeight() / 2) < 0 ? 0 : _center.y - getHeight() / 2;
+ return (_center.y - getHeight() / 2) < 0 ? 0 : _center.y - getHeight() / 2;
}
uint16 CelDecoder::CelVideoTrack::getTransparentColourIndex() {
- return _transparentColourIndex;
+ return _transparentColourIndex;
}
const Graphics::Surface *CelDecoder::CelVideoTrack::getCurrentFrame() {
- return _surface;
+ return _surface;
}
Common::Point CelDecoder::CelVideoTrack::getCenter() {
- return _center;
+ return _center;
}
Common::Rect &CelDecoder::CelVideoTrack::getRect() {
- return _rect;
+ return _rect;
}
#define FRAME_TYPE 0xF1FA
void CelDecoder::CelVideoTrack::skipFrame() {
- // Read chunk
- /*uint32 frameSize = */ _fileStream->readUint32LE();
- uint16 frameType = _fileStream->readUint16LE();
+ // Read chunk
+ /*uint32 frameSize = */ _fileStream->readUint32LE();
+ uint16 frameType = _fileStream->readUint16LE();
- switch (frameType) {
- case FRAME_TYPE:
- handleFrame();
- break;
- default:
- error("FlicDecoder::decodeFrame(): unknown main chunk type (type = 0x%02X)", frameType);
- break;
- }
+ switch (frameType) {
+ case FRAME_TYPE:
+ handleFrame();
+ break;
+ default:
+ error("FlicDecoder::decodeFrame(): unknown main chunk type (type = 0x%02X)", frameType);
+ break;
+ }
- _curFrame++;
- //_nextFrameStartTime += _frameDelay;
+ _curFrame++;
+ //_nextFrameStartTime += _frameDelay;
- if (_atRingFrame) {
- // If we decoded the ring frame, seek to the second frame
- _atRingFrame = false;
- _fileStream->seek(_offsetFrame2);
- }
+ if (_atRingFrame) {
+ // If we decoded the ring frame, seek to the second frame
+ _atRingFrame = false;
+ _fileStream->seek(_offsetFrame2);
+ }
- if (_curFrame == 0)
- _transparentColourIndex = *(byte*)_surface->getBasePtr(0,0);
+ if (_curFrame == 0)
+ _transparentColourIndex = *(byte*)_surface->getBasePtr(0,0);
}
const Graphics::Surface *CelDecoder::CelVideoTrack::decodeNextFrame() {
- // Read chunk
- /*uint32 frameSize = */ _fileStream->readUint32LE();
- uint16 frameType = _fileStream->readUint16LE();
+ // Read chunk
+ /*uint32 frameSize = */ _fileStream->readUint32LE();
+ uint16 frameType = _fileStream->readUint16LE();
- switch (frameType) {
- case FRAME_TYPE:
- handleFrame();
- break;
- default:
- error("FlicDecoder::decodeFrame(): unknown main chunk type (type = 0x%02X)", frameType);
- break;
- }
+ switch (frameType) {
+ case FRAME_TYPE:
+ handleFrame();
+ break;
+ default:
+ error("FlicDecoder::decodeFrame(): unknown main chunk type (type = 0x%02X)", frameType);
+ break;
+ }
- _curFrame++;
- _nextFrameStartTime += _frameDelay;
+ _curFrame++;
+ _nextFrameStartTime += _frameDelay;
- if (_atRingFrame) {
- // If we decoded the ring frame, seek to the second frame
- _atRingFrame = false;
- _fileStream->seek(_offsetFrame2);
- }
+ if (_atRingFrame) {
+ // If we decoded the ring frame, seek to the second frame
+ _atRingFrame = false;
+ _fileStream->seek(_offsetFrame2);
+ }
- if (_curFrame == 0)
- _transparentColourIndex = *(byte*)_surface->getBasePtr(0,0);
+ if (_curFrame == 0)
+ _transparentColourIndex = *(byte*)_surface->getBasePtr(0,0);
- return _surface;
+ return _surface;
}
void CelDecoder::CelVideoTrack::setX(int32 x) {
- _center.x = x ;//+ getWidth() / 2;
+ _center.x = x ;//+ getWidth() / 2;
}
void CelDecoder::CelVideoTrack::setY(int32 y) {
- _center.y = y;//+ getHeight() / 2;
+ _center.y = y;//+ getHeight() / 2;
}
} // End of namepsace Pink
diff --git a/engines/pink/cel_decoder.h b/engines/pink/cel_decoder.h
index 7ae9129ba8..1e4636bfee 100644
--- a/engines/pink/cel_decoder.h
+++ b/engines/pink/cel_decoder.h
@@ -29,46 +29,46 @@ namespace Pink {
class CelDecoder : public Video::FlicDecoder {
public:
- virtual bool loadStream(Common::SeekableReadStream *stream);
+ virtual bool loadStream(Common::SeekableReadStream *stream);
- int32 getX();
- int32 getY();
- uint16 getTransparentColourIndex();
+ int32 getX();
+ int32 getY();
+ uint16 getTransparentColourIndex();
- Common::Point getCenter();
- Common::Rect &getRectangle();
- const Graphics::Surface *getCurrentFrame();
- void skipFrame();
+ Common::Point getCenter();
+ Common::Rect &getRectangle();
+ const Graphics::Surface *getCurrentFrame();
+ void skipFrame();
- void setX(int32 x);
- void setY(int32 y);
+ void setX(int32 x);
+ void setY(int32 y);
protected:
- class CelVideoTrack : public FlicVideoTrack {
- public:
- CelVideoTrack(Common::SeekableReadStream *stream, uint16 frameCount, uint16 width, uint16 height, bool skipHeader = false);
- virtual void readHeader();
+ class CelVideoTrack : public FlicVideoTrack {
+ public:
+ CelVideoTrack(Common::SeekableReadStream *stream, uint16 frameCount, uint16 width, uint16 height, bool skipHeader = false);
+ virtual void readHeader();
- int32 getX() const;
- int32 getY() const;
- uint16 getTransparentColourIndex();
+ int32 getX() const;
+ int32 getY() const;
+ uint16 getTransparentColourIndex();
- Common::Point getCenter();
- Common::Rect &getRect();
- const Graphics::Surface *getCurrentFrame();
+ Common::Point getCenter();
+ Common::Rect &getRect();
+ const Graphics::Surface *getCurrentFrame();
- void setX(int32 x);
- void setY(int32 y);
+ void setX(int32 x);
+ void setY(int32 y);
- void skipFrame();
- private:
- const Graphics::Surface *decodeNextFrame();
- void readPrefixChunk();
+ void skipFrame();
+ private:
+ const Graphics::Surface *decodeNextFrame();
+ void readPrefixChunk();
- Common::Point _center;
- Common::Rect _rect;
- byte _transparentColourIndex;
- };
+ Common::Point _center;
+ Common::Rect _rect;
+ byte _transparentColourIndex;
+ };
};
}
diff --git a/engines/pink/console.h b/engines/pink/console.h
index 03f48821b1..bad3441203 100644
--- a/engines/pink/console.h
+++ b/engines/pink/console.h
@@ -31,9 +31,9 @@ class PinkEngine;
class Console : public GUI::Debugger {
public:
- Console(PinkEngine *vm) {}
+ Console(PinkEngine *vm) {}
- virtual ~Console(void) {}
+ virtual ~Console(void) {}
};
} // End of namespace Pink
diff --git a/engines/pink/constants.h b/engines/pink/constants.h
index b60d53f3c5..9cc624cf64 100644
--- a/engines/pink/constants.h
+++ b/engines/pink/constants.h
@@ -26,126 +26,126 @@
namespace Pink {
enum {
- kMaxClassLength = 32,
- kMaxStringLength = 128,
- kNullObject = 0
+ kMaxClassLength = 32,
+ kMaxStringLength = 128,
+ kNullObject = 0
};
enum {
- kActionHide,
- kActionLoop,
- kActionPlay,
- kActionPlayWithSfx,
- kActionSfx,
- kActionSound,
- kActionStill,
- kActionTalk,
- kActionText,
- kActor,
- kAudioInfoPDAButton,
- kConditionGameVariable,
- kConditionInventoryItemOwner,
- kConditionModuleVariable,
- kConditionNotInventoryItemOwner,
- kConditionNotModuleVariable,
- kConditionNotPageVariable,
- kConditionPageVariable,
- kCursorActor,
- kGamePage,
- kHandlerLeftClick,
- kHandlerStartPage,
- kHandlerTimer,
- kHandlerTimerActions,
- kHandlerTimerSequences,
- kHandlerUseClick,
- kInventoryActor,
- kInventoryItem,
- kLeadActor,
- kModuleProxy,
- kPDAButtonActor,
- kParlSqPink,
- kPubPink,
- kSeqTimer,
- kSequence,
- kSequenceAudio,
- kSequenceItem,
- kSequenceItemDefaultAction,
- kSequenceItemLeader,
- kSequenceItemLeaderAudio,
- kSideEffectExit,
- kSideEffectGameVariable,
- kSideEffectInventoryItemOwner,
- kSideEffectLocation,
- kSideEffectModuleVariable,
- kSideEffectPageVariable,
- kSideEffectRandomPageVariable,
- kSupportingActor,
- kWalkAction,
- kWalkLocation
+ kActionHide,
+ kActionLoop,
+ kActionPlay,
+ kActionPlayWithSfx,
+ kActionSfx,
+ kActionSound,
+ kActionStill,
+ kActionTalk,
+ kActionText,
+ kActor,
+ kAudioInfoPDAButton,
+ kConditionGameVariable,
+ kConditionInventoryItemOwner,
+ kConditionModuleVariable,
+ kConditionNotInventoryItemOwner,
+ kConditionNotModuleVariable,
+ kConditionNotPageVariable,
+ kConditionPageVariable,
+ kCursorActor,
+ kGamePage,
+ kHandlerLeftClick,
+ kHandlerStartPage,
+ kHandlerTimer,
+ kHandlerTimerActions,
+ kHandlerTimerSequences,
+ kHandlerUseClick,
+ kInventoryActor,
+ kInventoryItem,
+ kLeadActor,
+ kModuleProxy,
+ kPDAButtonActor,
+ kParlSqPink,
+ kPubPink,
+ kSeqTimer,
+ kSequence,
+ kSequenceAudio,
+ kSequenceItem,
+ kSequenceItemDefaultAction,
+ kSequenceItemLeader,
+ kSequenceItemLeaderAudio,
+ kSideEffectExit,
+ kSideEffectGameVariable,
+ kSideEffectInventoryItemOwner,
+ kSideEffectLocation,
+ kSideEffectModuleVariable,
+ kSideEffectPageVariable,
+ kSideEffectRandomPageVariable,
+ kSupportingActor,
+ kWalkAction,
+ kWalkLocation
};
enum {
- kCursorsCount = 11
+ kCursorsCount = 11
};
enum {
- kLoadingCursor = 0,
- kExitForwardCursor = 1,
- kExitLeftCursor = 2,
- kExitRightCursor = 3,
- kDefaultCursor = 4,
- kClickableFirstFrameCursor = 5,
- kClickableSecondFrameCursor = 6,
- kNotClickableCursor = 7,
- kHoldingItemCursor = 8,
- kPDAFirstCursor = 9,
- kPDASecondCursor = 10
+ kLoadingCursor = 0,
+ kExitForwardCursor = 1,
+ kExitLeftCursor = 2,
+ kExitRightCursor = 3,
+ kDefaultCursor = 4,
+ kClickableFirstFrameCursor = 5,
+ kClickableSecondFrameCursor = 6,
+ kNotClickableCursor = 7,
+ kHoldingItemCursor = 8,
+ kPDAFirstCursor = 9,
+ kPDASecondCursor = 10
};
// values are from Hokus Pokus
enum {
- kPokusLoadingCursorID = 135,
- kPokusExitForwardCursorID = 138,
- kPokusExitLeftCursorID = 133,
- kPokusExitRightCursorID = 134,
- kPokusClickableFirstCursorID = 137,
- kPokusClickableSecondCursorID = 136,
- kPokusClickableThirdCursorID = 145,
- kPokusNotClickableCursorID = 140,
- kPokusHoldingItemCursorID = 147,
- kPokusPDAFirstCursorID = 141,
- kPokusPDASecondCursorID = 144
+ kPokusLoadingCursorID = 135,
+ kPokusExitForwardCursorID = 138,
+ kPokusExitLeftCursorID = 133,
+ kPokusExitRightCursorID = 134,
+ kPokusClickableFirstCursorID = 137,
+ kPokusClickableSecondCursorID = 136,
+ kPokusClickableThirdCursorID = 145,
+ kPokusNotClickableCursorID = 140,
+ kPokusHoldingItemCursorID = 147,
+ kPokusPDAFirstCursorID = 141,
+ kPokusPDASecondCursorID = 144
};
// from Peril
// it contains cursors whose ids differ
enum {
- kPerilClickableThirdCursorID = 140,
- kPerilNotClickableCursorID = 139,
- kPerilHoldingItemCursorID = 101,
- kPerilPDASecondCursorID = 142
+ kPerilClickableThirdCursorID = 140,
+ kPerilNotClickableCursorID = 139,
+ kPerilHoldingItemCursorID = 101,
+ kPerilPDASecondCursorID = 142
};
enum {
- kLoadingSave = 1,
- kLoadingNewGame = 0
+ kLoadingSave = 1,
+ kLoadingNewGame = 0
};
enum {
- kOrbMajorVersion = 2,
- kOrbMinorVersion = 0,
- kBroMajorVersion = 1,
- kBroMinorVersion = 0,
+ kOrbMajorVersion = 2,
+ kOrbMinorVersion = 0,
+ kBroMajorVersion = 1,
+ kBroMinorVersion = 0,
};
enum {
- kTimersUpdateTime = 100,
- kCursorsUpdateTime = 200
+ kTimersUpdateTime = 100,
+ kCursorsUpdateTime = 200
};
enum {
- kSampleRate = 22050
+ kSampleRate = 22050
};
static const char *kPinkGame = "PinkGame";
diff --git a/engines/pink/cursor_mgr.cpp b/engines/pink/cursor_mgr.cpp
index 867a0f38a7..81fb61aa04 100644
--- a/engines/pink/cursor_mgr.cpp
+++ b/engines/pink/cursor_mgr.cpp
@@ -30,92 +30,92 @@
namespace Pink {
CursorMgr::CursorMgr(PinkEngine *game, GamePage *page)
- : _actor(nullptr), _page(page), _game(game),
- _isPlayingAnimation(0), _firstFrameIndex(0)
+ : _actor(nullptr), _page(page), _game(game),
+ _isPlayingAnimation(0), _firstFrameIndex(0)
{}
CursorMgr::~CursorMgr() {}
void CursorMgr::setCursor(uint index, Common::Point point, const Common::String &itemName) {
- if (index == kClickableFirstFrameCursor) {
- startAnimation(index);
- return hideItem();
- }
- else if (index != kHoldingItemCursor){
-
- if (index != kPDASecondCursor) {
- _game->setCursor(index);
- _isPlayingAnimation = 0;
- return hideItem();
- }
-
- hideItem();
- return startAnimation(index);
- }
-
- _game->setCursor(index);
- _isPlayingAnimation = 0;
-
- _actor = _actor ? _actor : _page->findActor(kCursor);
- assert(_actor);
-
- Action *action = _actor->findAction(itemName);
- assert(dynamic_cast<ActionCEL*>(action));
-
- if (action != _actor->getAction()) {
- _actor->setAction(action, 0);
- CelDecoder *decoder = static_cast<ActionCEL*>(action)->getDecoder();
- decoder->setX(point.x);
- decoder->setY(point.y);
- }
- else {
- CelDecoder *decoder = static_cast<ActionCEL*>(action)->getDecoder();
- decoder->setX(point.x);
- decoder->setY(point.y);
- }
+ if (index == kClickableFirstFrameCursor) {
+ startAnimation(index);
+ return hideItem();
+ }
+ else if (index != kHoldingItemCursor){
+
+ if (index != kPDASecondCursor) {
+ _game->setCursor(index);
+ _isPlayingAnimation = 0;
+ return hideItem();
+ }
+
+ hideItem();
+ return startAnimation(index);
+ }
+
+ _game->setCursor(index);
+ _isPlayingAnimation = 0;
+
+ _actor = _actor ? _actor : _page->findActor(kCursor);
+ assert(_actor);
+
+ Action *action = _actor->findAction(itemName);
+ assert(dynamic_cast<ActionCEL*>(action));
+
+ if (action != _actor->getAction()) {
+ _actor->setAction(action, 0);
+ CelDecoder *decoder = static_cast<ActionCEL*>(action)->getDecoder();
+ decoder->setX(point.x);
+ decoder->setY(point.y);
+ }
+ else {
+ CelDecoder *decoder = static_cast<ActionCEL*>(action)->getDecoder();
+ decoder->setX(point.x);
+ decoder->setY(point.y);
+ }
}
void CursorMgr::update() {
- if (!_isPlayingAnimation)
- return;
-
- uint newTime = _game->getTotalPlayTime();
- if (newTime - _time > kCursorsUpdateTime){
- _time = newTime;
- _isSecondFrame = !_isSecondFrame;
- _game->setCursor(_firstFrameIndex + _isSecondFrame);
- }
+ if (!_isPlayingAnimation)
+ return;
+
+ uint newTime = _game->getTotalPlayTime();
+ if (newTime - _time > kCursorsUpdateTime){
+ _time = newTime;
+ _isSecondFrame = !_isSecondFrame;
+ _game->setCursor(_firstFrameIndex + _isSecondFrame);
+ }
}
void CursorMgr::setCursor(Common::String &cursorName, Common::Point point) {
- uint index;
- if (cursorName == kCursorNameExitLeft) {
- index = kExitLeftCursor;
- }
- else if (cursorName == kCursorNameExitRight){
- index = kExitRightCursor;
- }
- else //if (cursorName == kCursorNameExitForward || cursorName == kCursorNameExitUp)
- index = kExitForwardCursor;
- //else assert(0);
-
-
- setCursor(index, point, Common::String());
+ uint index;
+ if (cursorName == kCursorNameExitLeft) {
+ index = kExitLeftCursor;
+ }
+ else if (cursorName == kCursorNameExitRight){
+ index = kExitRightCursor;
+ }
+ else //if (cursorName == kCursorNameExitForward || cursorName == kCursorNameExitUp)
+ index = kExitForwardCursor;
+ //else assert(0);
+
+
+ setCursor(index, point, Common::String());
}
void CursorMgr::hideItem() {
- if (_actor) _actor->hide();
+ if (_actor) _actor->hide();
}
void CursorMgr::startAnimation(int index) {
- if (!_isPlayingAnimation) {
- _isPlayingAnimation = 1;
- _time = _game->getTotalPlayTime();
- _firstFrameIndex = index;
- _isSecondFrame = 0;
- _game->setCursor(index);
- }
+ if (!_isPlayingAnimation) {
+ _isPlayingAnimation = 1;
+ _time = _game->getTotalPlayTime();
+ _firstFrameIndex = index;
+ _isSecondFrame = 0;
+ _game->setCursor(index);
+ }
}
} // End of namespace Pink
diff --git a/engines/pink/cursor_mgr.h b/engines/pink/cursor_mgr.h
index c873010681..4f10d2266a 100644
--- a/engines/pink/cursor_mgr.h
+++ b/engines/pink/cursor_mgr.h
@@ -38,26 +38,26 @@ class PinkEngine;
class CursorMgr : public Object {
public:
- CursorMgr(PinkEngine *game, GamePage *page);
- ~CursorMgr();
+ CursorMgr(PinkEngine *game, GamePage *page);
+ ~CursorMgr();
- void update();
- void setCursor(uint index, Common::Point point, const Common::String &itemName);
- void setCursor(Common::String &cursorName, Common::Point point);
+ void update();
+ void setCursor(uint index, Common::Point point, const Common::String &itemName);
+ void setCursor(Common::String &cursorName, Common::Point point);
private:
- void hideItem();
- void startAnimation(int index);
+ void hideItem();
+ void startAnimation(int index);
- Actor *_actor;
- GamePage *_page;
- PinkEngine *_game;
+ Actor *_actor;
+ GamePage *_page;
+ PinkEngine *_game;
- uint _time;
- uint _firstFrameIndex;
+ uint _time;
+ uint _firstFrameIndex;
- bool _isPlayingAnimation;
- bool _isSecondFrame;
+ bool _isPlayingAnimation;
+ bool _isSecondFrame;
};
} // End of namespace Pink
diff --git a/engines/pink/detection.cpp b/engines/pink/detection.cpp
index 546dd21592..f0a0901cbf 100644
--- a/engines/pink/detection.cpp
+++ b/engines/pink/detection.cpp
@@ -25,41 +25,41 @@
#include "pink/pink.h"
static const PlainGameDescriptor pinkGames[] = {
- {"peril", "The Pink Panther: Passport to Peril"},
- {"pokus", "The Pink Panther: Hokus Pokus Pink"},
- {0, 0}
+ {"peril", "The Pink Panther: Passport to Peril"},
+ {"pokus", "The Pink Panther: Hokus Pokus Pink"},
+ {0, 0}
};
#include "detection_tables.h"
class PinkMetaEngine : public AdvancedMetaEngine {
public:
- PinkMetaEngine() : AdvancedMetaEngine(Pink::gameDescriptions, sizeof(ADGameDescription), pinkGames) {
- _gameIds = pinkGames;
- }
+ PinkMetaEngine() : AdvancedMetaEngine(Pink::gameDescriptions, sizeof(ADGameDescription), pinkGames) {
+ _gameIds = pinkGames;
+ }
- virtual const char *getName() const {
- return "Pink Panther Engine";
- }
+ virtual const char *getName() const {
+ return "Pink Panther Engine";
+ }
- virtual const char *getOriginalCopyright() const {
- return "Pink Panther Engine (C) Wanderlust Interactive";
- }
+ virtual const char *getOriginalCopyright() const {
+ return "Pink Panther Engine (C) Wanderlust Interactive";
+ }
- //virtual bool hasFeature(MetaEngineFeature f) const;
- //virtual int getMaximumSaveSlot() const { return 0; }
- //virtual SaveStateList listSaves(const char *target) const;
- //virtual void removeSaveState(const char *target, int slot) const;
- //virtual SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const;
- virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const;
+ //virtual bool hasFeature(MetaEngineFeature f) const;
+ //virtual int getMaximumSaveSlot() const { return 0; }
+ //virtual SaveStateList listSaves(const char *target) const;
+ //virtual void removeSaveState(const char *target, int slot) const;
+ //virtual SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const;
+ virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const;
};
bool PinkMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
- if (desc) {
- *engine = new Pink::PinkEngine(syst, desc);
- }
+ if (desc) {
+ *engine = new Pink::PinkEngine(syst, desc);
+ }
- return desc != 0;
+ return desc != 0;
}
#if PLUGIN_ENABLED_DYNAMIC(PINK)
diff --git a/engines/pink/detection_tables.h b/engines/pink/detection_tables.h
index 5d31233719..e14e8895ac 100644
--- a/engines/pink/detection_tables.h
+++ b/engines/pink/detection_tables.h
@@ -28,30 +28,30 @@
namespace Pink {
static const ADGameDescription gameDescriptions[] = {
- {
- "peril",
- 0,{
- {"PPTP.ORB", NULL, NULL, -1},
- {"PPTP.BRO", NULL, NULL, -1},
- {"PPTP.EXE", NULL, NULL, -1},
- AD_LISTEND},
- Common::EN_ANY,
- Common::kPlatformWindows,
- ADGF_UNSTABLE,
- GUIO1(GUIO_NONE)
- },
- {
- "pokus",
- 0, {
- {"HPP.orb", NULL, NULL, -1},
- {"hpp.exe", NULL, NULL, -1},
- AD_LISTEND},
- Common::EN_ANY,
- Common::kPlatformWindows,
- ADGF_UNSTABLE,
- GUIO1(GUIO_NONE)
- },
- AD_TABLE_END_MARKER
+ {
+ "peril",
+ 0,{
+ {"PPTP.ORB", NULL, NULL, -1},
+ {"PPTP.BRO", NULL, NULL, -1},
+ {"PPTP.EXE", NULL, NULL, -1},
+ AD_LISTEND},
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO1(GUIO_NONE)
+ },
+ {
+ "pokus",
+ 0, {
+ {"HPP.orb", NULL, NULL, -1},
+ {"hpp.exe", NULL, NULL, -1},
+ AD_LISTEND},
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO1(GUIO_NONE)
+ },
+ AD_TABLE_END_MARKER
};
} // End of namespace Pink
diff --git a/engines/pink/director.cpp b/engines/pink/director.cpp
index 10c3e1d86b..4ac5c9424f 100644
--- a/engines/pink/director.cpp
+++ b/engines/pink/director.cpp
@@ -30,112 +30,112 @@
namespace Pink {
Director::Director(OSystem *system)
- : _system(system), showBounds(1) {}
+ : _system(system), showBounds(1) {}
void Director::draw() {
- _system->fillScreen(0);
- for (uint i = 0; i < _sprites.size(); ++i) {
- drawSprite(_sprites[i]);
- }
- _system->updateScreen();
+ _system->fillScreen(0);
+ for (uint i = 0; i < _sprites.size(); ++i) {
+ drawSprite(_sprites[i]);
+ }
+ _system->updateScreen();
}
void Director::drawSprite(ActionCEL *sprite) {
- CelDecoder *decoder = sprite->getDecoder();
- const Graphics::Surface *surface;
- if (decoder->needsUpdate()) {
-
- surface = decoder->decodeNextFrame();
- }
- else surface = decoder->getCurrentFrame();
-
- int h = surface->h;
- if (surface->h + decoder->getY() > 480)
- h = 480 - decoder->getY();
- int w = surface->w;
- if (surface->w + decoder->getX() > 640)
- w = 640 - decoder->getX();
-
- if (!showBounds) {
- Graphics::Surface *screen = _system->lockScreen();
-
- for (int y = 0; y < h; ++y) {
- for (int x = 0; x < w; ++x) {
- uint16 spritePixelColourIndex = *(byte*)surface->getBasePtr(x, y);
- if (spritePixelColourIndex != decoder->getTransparentColourIndex()) {
- *(byte *) screen->getBasePtr(decoder->getX() + x, decoder->getY() + y) = spritePixelColourIndex;
- }
- }
- }
- _system->unlockScreen();
- }
- else _system->copyRectToScreen(surface->getPixels(), surface->pitch,
- decoder->getX(), decoder->getY(),
- w, h);
+ CelDecoder *decoder = sprite->getDecoder();
+ const Graphics::Surface *surface;
+ if (decoder->needsUpdate()) {
+
+ surface = decoder->decodeNextFrame();
+ }
+ else surface = decoder->getCurrentFrame();
+
+ int h = surface->h;
+ if (surface->h + decoder->getY() > 480)
+ h = 480 - decoder->getY();
+ int w = surface->w;
+ if (surface->w + decoder->getX() > 640)
+ w = 640 - decoder->getX();
+
+ if (!showBounds) {
+ Graphics::Surface *screen = _system->lockScreen();
+
+ for (int y = 0; y < h; ++y) {
+ for (int x = 0; x < w; ++x) {
+ uint16 spritePixelColourIndex = *(byte*)surface->getBasePtr(x, y);
+ if (spritePixelColourIndex != decoder->getTransparentColourIndex()) {
+ *(byte *) screen->getBasePtr(decoder->getX() + x, decoder->getY() + y) = spritePixelColourIndex;
+ }
+ }
+ }
+ _system->unlockScreen();
+ }
+ else _system->copyRectToScreen(surface->getPixels(), surface->pitch,
+ decoder->getX(), decoder->getY(),
+ w, h);
}
void Director::addSprite(ActionCEL *sprite) {
- _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;
+ _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) {
- for (uint i = 0; i < _sprites.size(); ++i) {
- if (sprite == _sprites[i]) {
- _sprites.remove_at(i);
- break;
- }
- }
+ for (uint i = 0; i < _sprites.size(); ++i) {
+ if (sprite == _sprites[i]) {
+ _sprites.remove_at(i);
+ break;
+ }
+ }
}
void Director::setPallette(const byte *pallete) {
- _system->getPaletteManager()->setPalette(pallete, 0, 256);
+ _system->getPaletteManager()->setPalette(pallete, 0, 256);
}
void Director::update() {
- for (uint i = 0; i < _sounds.size(); ++i) {
- _sounds[i]->update();
- }
- for (uint i = 0; i < _sprites.size(); ++i) {
- _sprites[i]->update();
- }
+ for (uint i = 0; i < _sounds.size(); ++i) {
+ _sounds[i]->update();
+ }
+ for (uint i = 0; i < _sprites.size(); ++i) {
+ _sprites[i]->update();
+ }
}
void Director::addSound(ActionSound *sound) {
- _sounds.push_back(sound);
+ _sounds.push_back(sound);
}
void Director::removeSound(ActionSound *sound) {
- for (uint i = 0; i < _sounds.size(); ++i) {
- if (_sounds[i] == sound)
- _sounds.remove_at(i);
- }
+ for (uint i = 0; i < _sounds.size(); ++i) {
+ if (_sounds[i] == sound)
+ _sounds.remove_at(i);
+ }
}
void Director::clear() {
- _sprites.clear();
+ _sprites.clear();
}
Actor *Director::getActorByPoint(Common::Point point) {
- for (int i = _sprites.size() - 1; i >= 0; --i) {
- CelDecoder *decoder = _sprites[i]->getDecoder();
- const Graphics::Surface *frame = decoder->getCurrentFrame();
- Common::Rect &rect = decoder->getRectangle();
- if (rect.contains(point) &&
- *(byte*)frame->getBasePtr(point.x - rect.left, point.y - rect.top)
- != decoder->getTransparentColourIndex())
- return _sprites[i]->getActor();
- }
-
- return nullptr;
+ for (int i = _sprites.size() - 1; i >= 0; --i) {
+ CelDecoder *decoder = _sprites[i]->getDecoder();
+ const Graphics::Surface *frame = decoder->getCurrentFrame();
+ Common::Rect &rect = decoder->getRectangle();
+ if (rect.contains(point) &&
+ *(byte*)frame->getBasePtr(point.x - rect.left, point.y - rect.top)
+ != decoder->getTransparentColourIndex())
+ return _sprites[i]->getActor();
+ }
+
+ return nullptr;
}
}
diff --git a/engines/pink/director.h b/engines/pink/director.h
index c2decd0a66..b1566e7000 100644
--- a/engines/pink/director.h
+++ b/engines/pink/director.h
@@ -36,28 +36,28 @@ class CelDecoder;
class Director {
public:
- Director(OSystem *system);
- Actor *getActorByPoint(Common::Point point);
+ Director(OSystem *system);
+ Actor *getActorByPoint(Common::Point point);
- void draw();
- void update();
+ void draw();
+ void update();
- void addSprite(ActionCEL *sprite);
- void removeSprite(ActionCEL *sprite);
- void setPallette(const byte *pallete);
+ void addSprite(ActionCEL *sprite);
+ void removeSprite(ActionCEL *sprite);
+ void setPallette(const byte *pallete);
- void addSound(ActionSound* sound);
- void removeSound(ActionSound* sound);
+ void addSound(ActionSound* sound);
+ void removeSound(ActionSound* sound);
- void clear();
+ void clear();
- bool showBounds;
+ bool showBounds;
private:
- void drawSprite(ActionCEL *sprite);
- OSystem *_system;
- Common::Array<ActionCEL*> _sprites;
- Common::Array<ActionSound*> _sounds;
+ void drawSprite(ActionCEL *sprite);
+ 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 a62a9d83e2..68fc53c618 100644
--- a/engines/pink/file.cpp
+++ b/engines/pink/file.cpp
@@ -28,75 +28,75 @@
namespace Pink {
OrbFile::OrbFile()
- : File(), _timestamp(0),
- _tableOffset(0),
- _tableSize(0),
- _table(nullptr) {}
+ : File(), _timestamp(0),
+ _tableOffset(0),
+ _tableSize(0),
+ _table(nullptr) {}
OrbFile::~OrbFile() {
- delete[] _table;
+ delete[] _table;
}
bool OrbFile::open(const Common::String &name) {
- if (!File::open(name))
- return false;
+ if (!File::open(name))
+ return false;
- if (readUint32BE() != 'ORB\0'){
- return false;
- }
+ if (readUint32BE() != 'ORB\0'){
+ return false;
+ }
- uint16 minor = readUint16LE();
- uint16 major = readUint16LE();
+ uint16 minor = readUint16LE();
+ uint16 major = readUint16LE();
- debug("Orb v%hu.%hu loaded", major, minor);
+ debug("Orb v%hu.%hu loaded", major, minor);
- if (major != kOrbMajorVersion || minor != kOrbMinorVersion){
- return false;
- }
+ if (major != kOrbMajorVersion || minor != kOrbMinorVersion){
+ return false;
+ }
- if (!(_timestamp = readUint32LE())){
- return false;
- }
+ if (!(_timestamp = readUint32LE())){
+ return false;
+ }
- _tableOffset = readUint32LE();
- _tableSize = readUint32LE();
- _table = new ObjectDescription[_tableSize];
+ _tableOffset = readUint32LE();
+ _tableSize = readUint32LE();
+ _table = new ObjectDescription[_tableSize];
- seek(_tableOffset);
+ seek(_tableOffset);
- for (uint i = 0; i < _tableSize; ++i) {
- _table[i].load(*this);
- }
+ for (uint i = 0; i < _tableSize; ++i) {
+ _table[i].load(*this);
+ }
- return true;
+ return true;
}
void OrbFile::loadGame(PinkEngine *game) {
- seekToObject(kPinkGame);
- Archive archive(this);
- archive.mapObject(reinterpret_cast<Object*>(game)); // hack
- game->load(archive);
+ seekToObject(kPinkGame);
+ Archive archive(this);
+ archive.mapObject(reinterpret_cast<Object*>(game)); // hack
+ game->load(archive);
}
void OrbFile::loadObject(Object *obj, const Common::String &name) {
- seekToObject(name.c_str());
- Archive archive(this);
- obj->load(archive);
+ seekToObject(name.c_str());
+ Archive archive(this);
+ obj->load(archive);
}
void OrbFile::loadObject(Object *obj, ObjectDescription *objDesc) {
- seek(objDesc->objectsOffset);
- Archive archive(this);
- obj->load(archive);
+ seek(objDesc->objectsOffset);
+ Archive archive(this);
+ obj->load(archive);
}
uint32 OrbFile::getTimestamp() {
- return _timestamp;
+ return _timestamp;
}
void OrbFile::seekToObject(const char *name) {
- ObjectDescription *desc = getObjDesc(name);
- seek(desc->objectsOffset);
+ ObjectDescription *desc = getObjDesc(name);
+ seek(desc->objectsOffset);
}
static int objDescComp(const void *a, const void *b) {
@@ -104,56 +104,56 @@ static int objDescComp(const void *a, const void *b) {
}
ObjectDescription *OrbFile::getObjDesc(const char *name){
- ObjectDescription *desc = (ObjectDescription*) bsearch(name, _table, _tableSize, sizeof(ObjectDescription), objDescComp);
- assert(desc != nullptr);
- return desc;
+ ObjectDescription *desc = (ObjectDescription*) bsearch(name, _table, _tableSize, sizeof(ObjectDescription), objDescComp);
+ assert(desc != nullptr);
+ return desc;
}
ResourceDescription *OrbFile::getResDescTable(ObjectDescription *objDesc){
- ResourceDescription *table = new ResourceDescription[objDesc->resourcesCount];
- seek(objDesc->resourcesOffset);
+ ResourceDescription *table = new ResourceDescription[objDesc->resourcesCount];
+ seek(objDesc->resourcesOffset);
- for (uint i = 0; i < objDesc->resourcesCount; ++i) {
- table[i].load(*this);
- }
+ for (uint i = 0; i < objDesc->resourcesCount; ++i) {
+ table[i].load(*this);
+ }
- return table;
+ return table;
}
bool BroFile::open(const Common::String &name, uint32 orbTimestamp) {
- if (!File::open(name) || readUint32BE() != 'BRO\0')
- return false;
+ if (!File::open(name) || readUint32BE() != 'BRO\0')
+ return false;
- uint16 minor = readUint16LE();
- uint16 major = readUint16LE();
+ uint16 minor = readUint16LE();
+ uint16 major = readUint16LE();
- debug("Bro v%hu.%hu loaded", major, minor);
+ debug("Bro v%hu.%hu loaded", major, minor);
- if (major != kBroMajorVersion || minor != kBroMinorVersion){
- return false;
- }
+ if (major != kBroMajorVersion || minor != kBroMinorVersion){
+ return false;
+ }
- uint32 timestamp = readUint32LE();
+ uint32 timestamp = readUint32LE();
- return timestamp == orbTimestamp;
+ return timestamp == orbTimestamp;
}
void ObjectDescription::load(Common::File &file) {
- file.read(name, sizeof(name));
+ file.read(name, sizeof(name));
- objectsOffset = file.readUint32LE();
- objectsCount = file.readUint32LE();
- resourcesOffset = file.readUint32LE();
- resourcesCount = file.readUint32LE();
+ objectsOffset = file.readUint32LE();
+ objectsCount = file.readUint32LE();
+ resourcesOffset = file.readUint32LE();
+ resourcesCount = file.readUint32LE();
}
void ResourceDescription::load(Common::File &file) {
- file.read(name, sizeof(name));
+ file.read(name, sizeof(name));
- offset = file.readUint32LE();
- size = file.readUint32LE();
- inBro = (bool) file.readUint16LE();
+ offset = file.readUint32LE();
+ size = file.readUint32LE();
+ inBro = (bool) file.readUint16LE();
}
} // End of namespace Pink
diff --git a/engines/pink/file.h b/engines/pink/file.h
index 469885f566..094a332dd3 100644
--- a/engines/pink/file.h
+++ b/engines/pink/file.h
@@ -28,23 +28,23 @@
namespace Pink {
struct ObjectDescription {
- void load(Common::File &file);
+ void load(Common::File &file);
- char name[16];
- uint32 objectsOffset;
- uint32 objectsCount;
- uint32 resourcesOffset;
- uint32 resourcesCount;
+ char name[16];
+ uint32 objectsOffset;
+ uint32 objectsCount;
+ uint32 resourcesOffset;
+ uint32 resourcesCount;
};
struct ResourceDescription {
- void load(Common::File &file);
+ void load(Common::File &file);
- char name[16];
- uint32 offset;
- uint32 size;
- bool inBro; // in original it is short.
- // Don't know what's better to use.(Perhaps no difference because of padding)
+ char name[16];
+ uint32 offset;
+ uint32 size;
+ bool inBro; // in original it is short.
+ // Don't know what's better to use.(Perhaps no difference because of padding)
};
class PinkEngine;
@@ -52,30 +52,30 @@ class Object;
class OrbFile : public Common::File {
public:
- OrbFile();
- virtual ~OrbFile();
- virtual bool open(const Common::String &name);
+ OrbFile();
+ virtual ~OrbFile();
+ virtual bool open(const Common::String &name);
- void loadGame(PinkEngine *game);
- void loadObject(Object *obj, const Common::String &name);
- void loadObject(Object *obj, ObjectDescription *objDesc);
+ void loadGame(PinkEngine *game);
+ void loadObject(Object *obj, const Common::String &name);
+ void loadObject(Object *obj, ObjectDescription *objDesc);
- ObjectDescription *getObjDesc(const char *name);
- ResourceDescription *getResDescTable(ObjectDescription *objDesc);
+ ObjectDescription *getObjDesc(const char *name);
+ ResourceDescription *getResDescTable(ObjectDescription *objDesc);
- uint32 getTimestamp();
+ uint32 getTimestamp();
private:
- void seekToObject(const char *name);
+ void seekToObject(const char *name);
ObjectDescription *_table;
- uint32 _timestamp;
- uint32 _tableOffset;
- uint32 _tableSize;
+ uint32 _timestamp;
+ uint32 _tableOffset;
+ uint32 _tableSize;
};
class BroFile : public Common::File {
public:
- virtual bool open(const Common::String &name, uint32 orbTimestamp);
+ virtual bool open(const Common::String &name, uint32 orbTimestamp);
};
} // End of namespace Pink
diff --git a/engines/pink/module.mk b/engines/pink/module.mk
index 53627ec05f..94ba205260 100644
--- a/engines/pink/module.mk
+++ b/engines/pink/module.mk
@@ -1,48 +1,48 @@
MODULE := engines/pink
MODULE_OBJS = \
- archive.o \
- cel_decoder.o \
- console.o \
- cursor_mgr.o \
+ archive.o \
+ cel_decoder.o \
+ console.o \
+ cursor_mgr.o \
detection.o \
director.o \
file.o \
pink.o \
resource_mgr.o \
sound.o \
- objects/object.o \
- objects/module.o \
- objects/inventory.o \
- objects/side_effect.o \
- objects/condition.o \
- objects/actions/action.o \
- objects/actions/action_cel.o \
- objects/actions/action_hide.o \
- objects/actions/action_loop.o \
- objects/actions/action_play.o \
- objects/actions/action_play_with_sfx.o \
- objects/actions/action_sound.o \
- objects/actions/action_still.o \
- objects/actions/action_talk.o \
- objects/actions/action_text.o \
- objects/actions/walk_action.o \
- objects/actors/actor.o \
- objects/actors/lead_actor.o \
- objects/actors/supporting_actor.o \
- objects/handlers/handler.o \
- objects/handlers/handler_mgr.o \
- objects/handlers/handler_timer.o \
- objects/pages/page.o \
- objects/pages/game_page.o \
- objects/sequences/seq_timer.o \
- objects/sequences/sequence.o \
- objects/sequences/sequence_context.o \
- objects/sequences/sequence_item.o \
- objects/sequences/sequencer.o \
- objects/walk/walk_mgr.o \
- objects/walk/walk_location.o \
- objects/walk/walk_shortest_path.o \
+ objects/object.o \
+ objects/module.o \
+ objects/inventory.o \
+ objects/side_effect.o \
+ objects/condition.o \
+ objects/actions/action.o \
+ objects/actions/action_cel.o \
+ objects/actions/action_hide.o \
+ objects/actions/action_loop.o \
+ objects/actions/action_play.o \
+ objects/actions/action_play_with_sfx.o \
+ objects/actions/action_sound.o \
+ objects/actions/action_still.o \
+ objects/actions/action_talk.o \
+ objects/actions/action_text.o \
+ objects/actions/walk_action.o \
+ objects/actors/actor.o \
+ objects/actors/lead_actor.o \
+ objects/actors/supporting_actor.o \
+ objects/handlers/handler.o \
+ objects/handlers/handler_mgr.o \
+ objects/handlers/handler_timer.o \
+ objects/pages/page.o \
+ objects/pages/game_page.o \
+ objects/sequences/seq_timer.o \
+ objects/sequences/sequence.o \
+ objects/sequences/sequence_context.o \
+ objects/sequences/sequence_item.o \
+ objects/sequences/sequencer.o \
+ objects/walk/walk_mgr.o \
+ objects/walk/walk_location.o \
+ objects/walk/walk_shortest_path.o \
# This module can be built as a plugin
ifeq ($(ENABLE_PINK), DYNAMIC_PLUGIN)
@@ -50,4 +50,4 @@ PLUGIN := 1
endif
# Include common rules
-include $(srcdir)/rules.mk \ No newline at end of file
+include $(srcdir)/rules.mk
diff --git a/engines/pink/objects/actions/action.cpp b/engines/pink/objects/actions/action.cpp
index c6398833ae..934d6fc5be 100644
--- a/engines/pink/objects/actions/action.cpp
+++ b/engines/pink/objects/actions/action.cpp
@@ -27,8 +27,8 @@
namespace Pink {
void Action::deserialize(Archive &archive) {
- NamedObject::deserialize(archive);
- _actor = static_cast<Actor*>(archive.readObject());
+ NamedObject::deserialize(archive);
+ _actor = static_cast<Actor*>(archive.readObject());
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action.h b/engines/pink/objects/actions/action.h
index 0d57fbb129..241aee821f 100644
--- a/engines/pink/objects/actions/action.h
+++ b/engines/pink/objects/actions/action.h
@@ -32,21 +32,21 @@ class Director;
class Action : public NamedObject {
public:
- virtual void deserialize(Archive &archive);
- virtual void start(bool unk) {};
- virtual void end() {};
- virtual void update() {};
- virtual void toConsole() {};
+ virtual void deserialize(Archive &archive);
+ virtual void start(bool unk) {};
+ virtual void end() {};
+ virtual void update() {};
+ virtual void toConsole() {};
- virtual bool initPalette(Director *director) { return 0;}
+ virtual bool initPalette(Director *director) { return 0;}
- Actor *getActor() { return _actor;}
+ Actor *getActor() { return _actor;}
- virtual void pause() {};
- virtual void unpause() {};
+ virtual void pause() {};
+ virtual void unpause() {};
protected:
- Actor *_actor;
+ Actor *_actor;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_cel.cpp b/engines/pink/objects/actions/action_cel.cpp
index 352c635d68..f38c127782 100644
--- a/engines/pink/objects/actions/action_cel.cpp
+++ b/engines/pink/objects/actions/action_cel.cpp
@@ -32,64 +32,64 @@
namespace Pink {
ActionCEL::ActionCEL()
- : _decoder(nullptr) {
+ : _decoder(nullptr) {
}
void ActionCEL::deserialize(Archive &archive) {
- Action::deserialize(archive);
- _fileName = archive.readString();
- _z = archive.readDWORD();
+ Action::deserialize(archive);
+ _fileName = archive.readString();
+ _z = archive.readDWORD();
}
void ActionCEL::start(bool unk) {
- if (!_decoder)
- _decoder = _actor->getPage()->loadCel(_fileName);
- _actor->getPage()->getGame()->getDirector()->addSprite(this);
+ if (!_decoder)
+ _decoder = _actor->getPage()->loadCel(_fileName);
+ _actor->getPage()->getGame()->getDirector()->addSprite(this);
- this->onStart();
+ this->onStart();
}
void ActionCEL::end() {
- _actor->getPage()->getGame()->getDirector()->removeSprite(this);
- delete _decoder;
- _decoder = nullptr;
+ _actor->getPage()->getGame()->getDirector()->removeSprite(this);
+ delete _decoder;
+ _decoder = nullptr;
}
uint32 ActionCEL::getZ() {
- return _z;
+ return _z;
}
CelDecoder *ActionCEL::getDecoder() {
- return _decoder;
+ return _decoder;
}
bool ActionCEL::initPalette(Director *director) {
- _decoder = _actor->getPage()->loadCel(_fileName);
- _decoder->decodeNextFrame();
- _decoder->rewind();
- director->setPallette(_decoder->getPalette());
+ _decoder = _actor->getPage()->loadCel(_fileName);
+ _decoder->decodeNextFrame();
+ _decoder->rewind();
+ director->setPallette(_decoder->getPalette());
- return 1;
+ return 1;
}
void ActionCEL::update() {
- if (_decoder->endOfVideo()){
- _decoder->stop();
- _actor->endAction();
- }
+ if (_decoder->endOfVideo()){
+ _decoder->stop();
+ _actor->endAction();
+ }
}
ActionCEL::~ActionCEL() {
- end();
+ end();
}
void ActionCEL::pause() {
- _decoder->pauseVideo(1);
+ _decoder->pauseVideo(1);
}
void ActionCEL::unpause() {
- _decoder->pauseVideo(0);
+ _decoder->pauseVideo(0);
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_cel.h b/engines/pink/objects/actions/action_cel.h
index 937c23bc08..765fe8dd61 100644
--- a/engines/pink/objects/actions/action_cel.h
+++ b/engines/pink/objects/actions/action_cel.h
@@ -31,28 +31,28 @@ class CelDecoder;
class ActionCEL : public Action {
public:
- ~ActionCEL() override;
+ ~ActionCEL() override;
- ActionCEL();
- virtual void deserialize(Archive &archive);
- virtual void start(bool unk);
- virtual void end();
- virtual void update();
+ ActionCEL();
+ virtual void deserialize(Archive &archive);
+ virtual void start(bool unk);
+ virtual void end();
+ virtual void update();
- uint32 getZ();
- CelDecoder *getDecoder();
+ uint32 getZ();
+ CelDecoder *getDecoder();
- virtual bool initPalette(Director *director);
+ virtual bool initPalette(Director *director);
- void pause() override;
+ void pause() override;
- void unpause() override;
+ void unpause() override;
protected:
- virtual void onStart() {} ;
- CelDecoder *_decoder;
- Common::String _fileName;
- uint32 _z;
+ virtual void onStart() {} ;
+ CelDecoder *_decoder;
+ Common::String _fileName;
+ uint32 _z;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_hide.cpp b/engines/pink/objects/actions/action_hide.cpp
index a8a9a3a0b7..1732d2d967 100644
--- a/engines/pink/objects/actions/action_hide.cpp
+++ b/engines/pink/objects/actions/action_hide.cpp
@@ -27,20 +27,20 @@
namespace Pink {
void Pink::ActionHide::deserialize(Archive &archive) {
- Action::deserialize(archive);
+ Action::deserialize(archive);
}
void ActionHide::start(bool unk_startNow) {
- debug("Actor %s has now ActionHide %s", _actor->getName().c_str(), _name.c_str());
- _actor->endAction();
+ debug("Actor %s has now ActionHide %s", _actor->getName().c_str(), _name.c_str());
+ _actor->endAction();
}
void ActionHide::end() {
- debug("ActionHide %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
+ debug("ActionHide %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
}
void ActionHide::toConsole() {
- debug("\tActionHide: _name = %s", _name.c_str());
+ debug("\tActionHide: _name = %s", _name.c_str());
}
ActionHide::~ActionHide() {}
diff --git a/engines/pink/objects/actions/action_hide.h b/engines/pink/objects/actions/action_hide.h
index a7c23a4b15..eb2b8da519 100644
--- a/engines/pink/objects/actions/action_hide.h
+++ b/engines/pink/objects/actions/action_hide.h
@@ -29,13 +29,13 @@ namespace Pink {
class ActionHide : public Action {
public:
- ~ActionHide() override;
+ ~ActionHide() override;
- virtual void deserialize(Archive &archive);
- virtual void toConsole();
+ virtual void deserialize(Archive &archive);
+ virtual void toConsole();
- virtual void start(bool unk);
- virtual void end();
+ virtual void start(bool unk);
+ virtual void end();
};
} //End of namespace Pink
diff --git a/engines/pink/objects/actions/action_loop.cpp b/engines/pink/objects/actions/action_loop.cpp
index 77a17630e2..f32a3a4035 100644
--- a/engines/pink/objects/actions/action_loop.cpp
+++ b/engines/pink/objects/actions/action_loop.cpp
@@ -28,42 +28,42 @@
namespace Pink {
void ActionLoop::deserialize(Archive &archive) {
- ActionPlay::deserialize(archive);
- uint16 style;
- _intro = archive.readDWORD();
- style = archive.readWORD();
- switch (style) {
- case kPingPong:
- _style = kPingPong;
- break;
- case kRandom:
- _style = kRandom;
- break;
- default:
- _style = kForward;
- break;
- }
+ ActionPlay::deserialize(archive);
+ uint16 style;
+ _intro = archive.readDWORD();
+ style = archive.readWORD();
+ switch (style) {
+ case kPingPong:
+ _style = kPingPong;
+ break;
+ case kRandom:
+ _style = kRandom;
+ break;
+ default:
+ _style = kForward;
+ break;
+ }
}
void ActionLoop::toConsole() {
- debug("\tActionLoop: _name = %s, _fileName = %s, z = %u, _startFrame = %u,"
- " _endFrame = %d, _intro = %u, _style = %u",
- _name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame, _intro, _style);
+ debug("\tActionLoop: _name = %s, _fileName = %s, z = %u, _startFrame = %u,"
+ " _endFrame = %d, _intro = %u, _style = %u",
+ _name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame, _intro, _style);
}
void ActionLoop::update() {
- // for now it supports only forward loop animation
- if (_style == kForward) {
- if (_decoder->endOfVideo() || _decoder->getCurFrame() == _stopFrame){
- //debug("ACTION LOOP : NEXT ITERATION");
- _decoder->rewind();
- }
- }
+ // for now it supports only forward loop animation
+ if (_style == kForward) {
+ if (_decoder->endOfVideo() || _decoder->getCurFrame() == _stopFrame){
+ //debug("ACTION LOOP : NEXT ITERATION");
+ _decoder->rewind();
+ }
+ }
}
void ActionLoop::onStart() {
- ActionPlay::onStart();
- _actor->endAction();
+ ActionPlay::onStart();
+ _actor->endAction();
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_loop.h b/engines/pink/objects/actions/action_loop.h
index 12c9e2dd88..0b8132aa5c 100644
--- a/engines/pink/objects/actions/action_loop.h
+++ b/engines/pink/objects/actions/action_loop.h
@@ -29,19 +29,19 @@ namespace Pink {
class ActionLoop : public ActionPlay {
public:
- virtual void deserialize(Archive &archive);
- virtual void toConsole();
- virtual void update();
+ virtual void deserialize(Archive &archive);
+ virtual void toConsole();
+ virtual void update();
protected:
- virtual void onStart();
+ virtual void onStart();
- enum Style {
- kPingPong = 2,
- kRandom = 3,
- kForward = 4
- };
- uint _intro;
- Style _style;
+ enum Style {
+ kPingPong = 2,
+ kRandom = 3,
+ kForward = 4
+ };
+ uint _intro;
+ Style _style;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_play.cpp b/engines/pink/objects/actions/action_play.cpp
index 6ab21db32e..6ae56df349 100644
--- a/engines/pink/objects/actions/action_play.cpp
+++ b/engines/pink/objects/actions/action_play.cpp
@@ -30,34 +30,34 @@
namespace Pink {
void ActionPlay::deserialize(Archive &archive) {
- ActionStill::deserialize(archive);
- _stopFrame = archive.readDWORD();
+ ActionStill::deserialize(archive);
+ _stopFrame = archive.readDWORD();
}
void ActionPlay::toConsole() {
- debug("\tActionPlay: _name = %s, _fileName = %s, z = %u, _startFrame = %u,"
- " _endFrame = %d", _name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame);
+ debug("\tActionPlay: _name = %s, _fileName = %s, z = %u, _startFrame = %u,"
+ " _endFrame = %d", _name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame);
}
void ActionPlay::end() {
- ActionCEL::end();
- debug("ActionPlay %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
+ ActionCEL::end();
+ debug("ActionPlay %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
}
void ActionPlay::onStart() {
- debug("Actor %s has now ActionPlay %s", _actor->getName().c_str(), _name.c_str());
- _decoder->start();
- for (uint i = 0; i < _startFrame; ++i) {
- _decoder->skipFrame();
- }
- _decoder->decodeNextFrame();
+ debug("Actor %s has now ActionPlay %s", _actor->getName().c_str(), _name.c_str());
+ _decoder->start();
+ for (uint i = 0; i < _startFrame; ++i) {
+ _decoder->skipFrame();
+ }
+ _decoder->decodeNextFrame();
}
void ActionPlay::update() {
- if (_decoder->endOfVideo() || _decoder->getCurFrame() == _stopFrame){
- _decoder->stop();
- _actor->endAction();
- }
+ if (_decoder->endOfVideo() || _decoder->getCurFrame() == _stopFrame){
+ _decoder->stop();
+ _actor->endAction();
+ }
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_play.h b/engines/pink/objects/actions/action_play.h
index 319d05921c..6553bb1776 100644
--- a/engines/pink/objects/actions/action_play.h
+++ b/engines/pink/objects/actions/action_play.h
@@ -29,17 +29,17 @@ namespace Pink {
class ActionPlay : public ActionStill {
public:
- virtual void deserialize(Archive &archive);
- virtual void toConsole();
+ virtual void deserialize(Archive &archive);
+ virtual void toConsole();
- virtual void end();
+ virtual void end();
- void update() override;
+ void update() override;
protected:
- virtual void onStart();
+ virtual void onStart();
- int32 _stopFrame;
+ int32 _stopFrame;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_play_with_sfx.cpp b/engines/pink/objects/actions/action_play_with_sfx.cpp
index e6f557051f..9cb850384e 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.cpp
+++ b/engines/pink/objects/actions/action_play_with_sfx.cpp
@@ -29,90 +29,90 @@
namespace Pink {
void ActionPlayWithSfx::deserialize(Pink::Archive &archive) {
- ActionPlay::deserialize(archive);
- _isLoop = archive.readDWORD();
- _sfxArray.deserialize(archive);
+ ActionPlay::deserialize(archive);
+ _isLoop = archive.readDWORD();
+ _sfxArray.deserialize(archive);
}
void ActionPlayWithSfx::toConsole() {
- debug("\tActionPlayWithSfx: _name = %s, _fileName = %s, z = %u, _startFrame = %u,"
- " _endFrame = %d, _isLoop = %u", _name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame, _isLoop);
- for (uint i = 0; i < _sfxArray.size(); ++i) {
- _sfxArray[i]->toConsole();
- }
+ debug("\tActionPlayWithSfx: _name = %s, _fileName = %s, z = %u, _startFrame = %u,"
+ " _endFrame = %d, _isLoop = %u", _name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame, _isLoop);
+ for (uint i = 0; i < _sfxArray.size(); ++i) {
+ _sfxArray[i]->toConsole();
+ }
}
void ActionPlayWithSfx::update() {
- if ((_decoder->endOfVideo() || _decoder->getCurFrame() == _stopFrame) && _isLoop) {
- _decoder->rewind();
- } else if (_decoder->endOfVideo() || _decoder->getCurFrame() == _stopFrame) {
- _decoder->stop();
- _actor->endAction();
- }
-
- updateSound();
+ if ((_decoder->endOfVideo() || _decoder->getCurFrame() == _stopFrame) && _isLoop) {
+ _decoder->rewind();
+ } else if (_decoder->endOfVideo() || _decoder->getCurFrame() == _stopFrame) {
+ _decoder->stop();
+ _actor->endAction();
+ }
+
+ updateSound();
}
void ActionPlayWithSfx::onStart() {
- ActionPlay::onStart();
- if (_isLoop) {
- _actor->endAction();
- }
- updateSound();
+ ActionPlay::onStart();
+ if (_isLoop) {
+ _actor->endAction();
+ }
+ updateSound();
}
void ActionPlayWithSfx::updateSound() {
- if (!_actor->isPlaying() && !_isLoop)
- return;
-
- for (uint i = 0; i < _sfxArray.size(); ++i) {
- if (_sfxArray[i]->getFrame() == _decoder->getCurFrame()) {
- _sfxArray[i]->play(_actor->getPage());
- }
- }
+ if (!_actor->isPlaying() && !_isLoop)
+ return;
+
+ for (uint i = 0; i < _sfxArray.size(); ++i) {
+ if (_sfxArray[i]->getFrame() == _decoder->getCurFrame()) {
+ _sfxArray[i]->play(_actor->getPage());
+ }
+ }
}
ActionPlayWithSfx::~ActionPlayWithSfx() {
- ActionPlay::end();
- for (uint i = 0; i < _sfxArray.size(); ++i) {
- delete _sfxArray[i];
- }
+ ActionPlay::end();
+ for (uint i = 0; i < _sfxArray.size(); ++i) {
+ delete _sfxArray[i];
+ }
}
void ActionSfx::deserialize(Pink::Archive &archive) {
- _frame = archive.readDWORD();
+ _frame = archive.readDWORD();
_volume = archive.readDWORD();
- _sfxName = archive.readString();
- archive.readObject(); // pointer of ActionPlayWithSfx
+ _sfxName = archive.readString();
+ archive.readObject(); // pointer of ActionPlayWithSfx
}
void ActionSfx::toConsole() {
- debug("\t\tActionSfx: _sfx = %s, _volume = %u, _frame = %u", _sfxName.c_str(), _volume, _frame);
+ debug("\t\tActionSfx: _sfx = %s, _volume = %u, _frame = %u", _sfxName.c_str(), _volume, _frame);
}
void ActionSfx::play(GamePage *page) {
- if (!_sound)
- _sound = page->loadSound(_sfxName);
+ if (!_sound)
+ _sound = page->loadSound(_sfxName);
- if (!_sound->isPlaying())
- _sound->play(Audio::Mixer::SoundType::kSFXSoundType, _volume, 0);
+ if (!_sound->isPlaying())
+ _sound->play(Audio::Mixer::SoundType::kSFXSoundType, _volume, 0);
}
ActionSfx::~ActionSfx() {
- end();
+ end();
}
uint32 ActionSfx::getFrame() {
- return _frame;
+ return _frame;
}
ActionSfx::ActionSfx()
- : _sound(nullptr)
+ : _sound(nullptr)
{}
void ActionSfx::end() {
- delete _sound;
- _sound = nullptr;
+ delete _sound;
+ _sound = nullptr;
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_play_with_sfx.h b/engines/pink/objects/actions/action_play_with_sfx.h
index 865f3685cc..89b2ec61ab 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.h
+++ b/engines/pink/objects/actions/action_play_with_sfx.h
@@ -31,18 +31,18 @@ class ActionSfx;
class ActionPlayWithSfx : public ActionPlay {
public:
- virtual ~ActionPlayWithSfx();
- virtual void deserialize(Archive &archive);
- virtual void toConsole();
- virtual void update();
+ virtual ~ActionPlayWithSfx();
+ virtual void deserialize(Archive &archive);
+ virtual void toConsole();
+ virtual void update();
protected:
- virtual void onStart();
+ virtual void onStart();
private:
- void updateSound();
- uint32 _isLoop;
- Array<ActionSfx*> _sfxArray;
+ void updateSound();
+ uint32 _isLoop;
+ Array<ActionSfx*> _sfxArray;
};
class Sound;
@@ -50,20 +50,20 @@ class GamePage;
class ActionSfx : public Object {
public:
- ActionSfx();
- virtual ~ActionSfx();
- virtual void deserialize(Archive &archive);
- virtual void toConsole();
+ ActionSfx();
+ virtual ~ActionSfx();
+ virtual void deserialize(Archive &archive);
+ virtual void toConsole();
- void play(GamePage *page);
- uint32 getFrame();
- void end();
+ void play(GamePage *page);
+ uint32 getFrame();
+ void end();
private:
- Sound *_sound;
- Common::String _sfxName;
- uint32 _volume;
- uint32 _frame;
+ Sound *_sound;
+ Common::String _sfxName;
+ uint32 _volume;
+ uint32 _frame;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_sound.cpp b/engines/pink/objects/actions/action_sound.cpp
index 45d74be23a..e94251d9c0 100644
--- a/engines/pink/objects/actions/action_sound.cpp
+++ b/engines/pink/objects/actions/action_sound.cpp
@@ -32,68 +32,68 @@
namespace Pink {
ActionSound::ActionSound()
- : _sound(nullptr)
+ : _sound(nullptr)
{}
ActionSound::~ActionSound(){
- end();
+ end();
}
void ActionSound::deserialize(Archive &archive) {
- Action::deserialize(archive);
- _fileName = archive.readString();
- _volume = archive.readDWORD();
- _isLoop = (bool) archive.readDWORD();
- _isBackground = (bool) archive.readDWORD();
+ Action::deserialize(archive);
+ _fileName = archive.readString();
+ _volume = archive.readDWORD();
+ _isLoop = (bool) archive.readDWORD();
+ _isBackground = (bool) archive.readDWORD();
}
void ActionSound::toConsole() {
- debug("\tActionSound: _name = %s, _fileName = %s, _volume = %u, _isLoop = %u,"
- " _isBackground = %u", _name.c_str(), _fileName.c_str(), _volume, _isLoop, _isBackground);
+ debug("\tActionSound: _name = %s, _fileName = %s, _volume = %u, _isLoop = %u,"
+ " _isBackground = %u", _name.c_str(), _fileName.c_str(), _volume, _isLoop, _isBackground);
}
void ActionSound::start(bool unk) {
- assert(!_sound);
- _sound = _actor->getPage()->loadSound(_fileName);
+ assert(!_sound);
+ _sound = _actor->getPage()->loadSound(_fileName);
- Audio::Mixer::SoundType soundType = _isBackground ? Audio::Mixer::SoundType::kMusicSoundType
- : Audio::Mixer::SoundType::kSpeechSoundType;
+ Audio::Mixer::SoundType soundType = _isBackground ? Audio::Mixer::SoundType::kMusicSoundType
+ : Audio::Mixer::SoundType::kSpeechSoundType;
- Director *director = _actor->getPage()->getGame()->getDirector();
- director->addSound(this);
+ Director *director = _actor->getPage()->getGame()->getDirector();
+ director->addSound(this);
- _sound->play(soundType, _volume, _isLoop);
- if (_isLoop)
- _actor->endAction();
+ _sound->play(soundType, _volume, _isLoop);
+ if (_isLoop)
+ _actor->endAction();
- debug("Actor %s has now ActionSound %s", _actor->getName().c_str(), _name.c_str());
+ debug("Actor %s has now ActionSound %s", _actor->getName().c_str(), _name.c_str());
}
void ActionSound::end() {
- if (_sound) {
- debug("ActionSound %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
+ if (_sound) {
+ debug("ActionSound %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
- Director *director = _actor->getPage()->getGame()->getDirector();
- director->removeSound(this);
+ Director *director = _actor->getPage()->getGame()->getDirector();
+ director->removeSound(this);
- delete _sound;
- _sound = nullptr;
- }
+ delete _sound;
+ _sound = nullptr;
+ }
}
void ActionSound::update() {
- if (!_sound->isPlaying())
- _actor->endAction();
+ if (!_sound->isPlaying())
+ _actor->endAction();
}
void ActionSound::pause() {
- if (_sound)
- _sound->pause();
+ if (_sound)
+ _sound->pause();
}
void ActionSound::unpause() {
- if (_sound)
- _sound->resume();
+ if (_sound)
+ _sound->resume();
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_sound.h b/engines/pink/objects/actions/action_sound.h
index 0fb39bbf66..6e18f97c67 100644
--- a/engines/pink/objects/actions/action_sound.h
+++ b/engines/pink/objects/actions/action_sound.h
@@ -31,26 +31,26 @@ class Sound;
class ActionSound : public Action {
public:
- ActionSound();
- ~ActionSound();
+ ActionSound();
+ ~ActionSound();
- virtual void deserialize(Archive &archive);
+ virtual void deserialize(Archive &archive);
- virtual void toConsole();
+ virtual void toConsole();
- virtual void start(bool unk_startNow);
- virtual void end();
- virtual void update();
+ virtual void start(bool unk_startNow);
+ virtual void end();
+ virtual void update();
- void pause() override;
- void unpause() override;
+ void pause() override;
+ void unpause() override;
private:
- Sound *_sound;
- Common::String _fileName;
- uint32 _volume;
- bool _isLoop;
- bool _isBackground;
+ Sound *_sound;
+ Common::String _fileName;
+ uint32 _volume;
+ bool _isLoop;
+ bool _isBackground;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_still.cpp b/engines/pink/objects/actions/action_still.cpp
index c72e6347b4..ebdde4ed09 100644
--- a/engines/pink/objects/actions/action_still.cpp
+++ b/engines/pink/objects/actions/action_still.cpp
@@ -30,28 +30,28 @@
namespace Pink {
void ActionStill::deserialize(Archive &archive) {
- ActionCEL::deserialize(archive);
- _startFrame = archive.readDWORD();
+ ActionCEL::deserialize(archive);
+ _startFrame = archive.readDWORD();
}
void ActionStill::toConsole() {
- debug("\tActionStill: _name = %s, _fileName = %s, _z =%u _startFrame = %u",
- _name.c_str(), _fileName.c_str(), _z, _startFrame);
+ debug("\tActionStill: _name = %s, _fileName = %s, _z =%u _startFrame = %u",
+ _name.c_str(), _fileName.c_str(), _z, _startFrame);
}
void ActionStill::end() {
- ActionCEL::end();
- debug("ActionStill %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
+ ActionCEL::end();
+ debug("ActionStill %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
}
void ActionStill::onStart() {
- debug("Actor %s has now ActionStill %s", _actor->getName().c_str(), _name.c_str());
- for (uint i = 0; i < _startFrame; ++i) {
- _decoder->skipFrame();
- }
- _decoder->decodeNextFrame();
- _decoder->stop();
- _actor->endAction();
+ debug("Actor %s has now ActionStill %s", _actor->getName().c_str(), _name.c_str());
+ for (uint i = 0; i < _startFrame; ++i) {
+ _decoder->skipFrame();
+ }
+ _decoder->decodeNextFrame();
+ _decoder->stop();
+ _actor->endAction();
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_still.h b/engines/pink/objects/actions/action_still.h
index cef3967e33..a62b201ce8 100644
--- a/engines/pink/objects/actions/action_still.h
+++ b/engines/pink/objects/actions/action_still.h
@@ -29,15 +29,15 @@ namespace Pink {
class ActionStill : public ActionCEL {
public:
- virtual void deserialize(Archive &archive);
- virtual void toConsole();
+ virtual void deserialize(Archive &archive);
+ virtual void toConsole();
- virtual void end();
+ virtual void end();
protected:
- virtual void onStart();
+ virtual void onStart();
- uint32 _startFrame;
+ uint32 _startFrame;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_talk.cpp b/engines/pink/objects/actions/action_talk.cpp
index fad3f19ff9..1f55de1f42 100644
--- a/engines/pink/objects/actions/action_talk.cpp
+++ b/engines/pink/objects/actions/action_talk.cpp
@@ -30,46 +30,46 @@
namespace Pink {
void ActionTalk::deserialize(Archive &archive) {
- ActionLoop::deserialize(archive);
- _vox = archive.readString();
+ ActionLoop::deserialize(archive);
+ _vox = archive.readString();
}
void ActionTalk::toConsole() {
- debug("\tActionTalk: _name = %s, _fileName = %s, z = %u, _startFrame = %u,"
- " _endFrame = %d, _intro = %u, _style = %u, _vox = %s",
- _name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame, _intro, _style, _vox.c_str());
+ debug("\tActionTalk: _name = %s, _fileName = %s, z = %u, _startFrame = %u,"
+ " _endFrame = %d, _intro = %u, _style = %u, _vox = %s",
+ _name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame, _intro, _style, _vox.c_str());
}
void ActionTalk::onStart() {
- ActionPlay::onStart();
- _sound = _actor->getPage()->loadSound(_vox);
- _sound->play(Audio::Mixer::SoundType::kSpeechSoundType, 100, 0);
+ ActionPlay::onStart();
+ _sound = _actor->getPage()->loadSound(_vox);
+ _sound->play(Audio::Mixer::SoundType::kSpeechSoundType, 100, 0);
}
void ActionTalk::update() {
- ActionLoop::update();
- if (!_sound->isPlaying()) {
- _decoder->stop();
- _actor->endAction();
- }
+ ActionLoop::update();
+ if (!_sound->isPlaying()) {
+ _decoder->stop();
+ _actor->endAction();
+ }
}
void ActionTalk::end() {
- ActionPlay::end();
- delete _sound;
- _sound = nullptr;
+ ActionPlay::end();
+ delete _sound;
+ _sound = nullptr;
}
void ActionTalk::pause() {
- ActionCEL::pause();
- if (_sound)
- _sound->pause();
+ ActionCEL::pause();
+ if (_sound)
+ _sound->pause();
}
void ActionTalk::unpause() {
- ActionCEL::unpause();
- if (_sound)
- _sound->resume();
+ ActionCEL::unpause();
+ if (_sound)
+ _sound->resume();
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_talk.h b/engines/pink/objects/actions/action_talk.h
index 77e8d9099d..61ef1a452f 100644
--- a/engines/pink/objects/actions/action_talk.h
+++ b/engines/pink/objects/actions/action_talk.h
@@ -31,21 +31,21 @@ class Sound;
class ActionTalk : public ActionLoop {
public:
- virtual void deserialize(Archive &archive);
- virtual void toConsole();
- virtual void update();
+ virtual void deserialize(Archive &archive);
+ virtual void toConsole();
+ virtual void update();
- virtual void end();
+ virtual void end();
- void pause() override;
- void unpause() override;
+ void pause() override;
+ void unpause() override;
protected:
- virtual void onStart();
+ virtual void onStart();
private:
- Sound *_sound;
- Common::String _vox;
+ Sound *_sound;
+ Common::String _vox;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_text.cpp b/engines/pink/objects/actions/action_text.cpp
index 12e2809d21..3e05346b88 100644
--- a/engines/pink/objects/actions/action_text.cpp
+++ b/engines/pink/objects/actions/action_text.cpp
@@ -28,19 +28,19 @@
namespace Pink {
void ActionText::deserialize(Archive &archive) {
- for (int i = 0; i < 4 ; ++i) {
- _bounds[i] = archive.readDWORD();
- }
- _centered = archive.readDWORD();
- _scrollBar = archive.readDWORD();
- _textColor = archive.readDWORD();
- _backgroundColor = archive.readDWORD();
+ for (int i = 0; i < 4 ; ++i) {
+ _bounds[i] = archive.readDWORD();
+ }
+ _centered = archive.readDWORD();
+ _scrollBar = archive.readDWORD();
+ _textColor = archive.readDWORD();
+ _backgroundColor = archive.readDWORD();
}
void ActionText::toConsole() {
- debug("\tActionText: _name = %s, _text = %s, "
- "_bound0 = %u, _bound1 = %u, _bound2 = %u, _bound3 = %u _centered = %u, _scrollBar = %u, _textColor = %u _backgroundColor = %u",
- _name.c_str(), _text.c_str(), _bounds[0], _bounds[1], _bounds[2], _bounds[3], _centered, _scrollBar, _textColor, _backgroundColor);
+ debug("\tActionText: _name = %s, _text = %s, "
+ "_bound0 = %u, _bound1 = %u, _bound2 = %u, _bound3 = %u _centered = %u, _scrollBar = %u, _textColor = %u _backgroundColor = %u",
+ _name.c_str(), _text.c_str(), _bounds[0], _bounds[1], _bounds[2], _bounds[3], _centered, _scrollBar, _textColor, _backgroundColor);
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_text.h b/engines/pink/objects/actions/action_text.h
index 22159490ce..c881610fad 100644
--- a/engines/pink/objects/actions/action_text.h
+++ b/engines/pink/objects/actions/action_text.h
@@ -29,17 +29,17 @@ namespace Pink {
class ActionText : public Action {
public:
- void deserialize(Archive &archive) override;
+ void deserialize(Archive &archive) override;
- void toConsole() override;
+ void toConsole() override;
private:
- Common::String _text;
- uint32 _bounds[4];
- uint32 _centered;
- uint32 _scrollBar;
- uint32 _textColor;
- uint32 _backgroundColor;
+ Common::String _text;
+ uint32 _bounds[4];
+ uint32 _centered;
+ uint32 _scrollBar;
+ uint32 _textColor;
+ uint32 _backgroundColor;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/walk_action.cpp b/engines/pink/objects/actions/walk_action.cpp
index d05e94eadb..e4e35184ca 100644
--- a/engines/pink/objects/actions/walk_action.cpp
+++ b/engines/pink/objects/actions/walk_action.cpp
@@ -27,18 +27,18 @@
namespace Pink {
void WalkAction::deserialize(Archive &archive) {
- ActionCEL::deserialize(archive);
- uint32 calcFramePositions = archive.readDWORD();
- _toCalcFramePositions = calcFramePositions;
+ ActionCEL::deserialize(archive);
+ uint32 calcFramePositions = archive.readDWORD();
+ _toCalcFramePositions = calcFramePositions;
}
void WalkAction::toConsole() {
- debug("\tWalkAction: _name = %s, _fileName = %s, _calcFramePositions = %u",
- _name.c_str(), _fileName.c_str(), _toCalcFramePositions);
+ debug("\tWalkAction: _name = %s, _fileName = %s, _calcFramePositions = %u",
+ _name.c_str(), _fileName.c_str(), _toCalcFramePositions);
}
void WalkAction::onStart() {
- _decoder->start();
+ _decoder->start();
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/walk_action.h b/engines/pink/objects/actions/walk_action.h
index 21926ab9c1..d53c8c2bdc 100644
--- a/engines/pink/objects/actions/walk_action.h
+++ b/engines/pink/objects/actions/walk_action.h
@@ -29,15 +29,15 @@ namespace Pink {
class WalkAction : public ActionCEL {
public:
- virtual void deserialize(Archive &archive);
+ virtual void deserialize(Archive &archive);
- virtual void toConsole();
+ virtual void toConsole();
protected:
- void onStart() override;
+ void onStart() override;
private:
- bool _toCalcFramePositions;
+ bool _toCalcFramePositions;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp
index 4853f8d2ff..e6545f3a1f 100644
--- a/engines/pink/objects/actors/actor.cpp
+++ b/engines/pink/objects/actors/actor.cpp
@@ -30,20 +30,20 @@
namespace Pink {
void Actor::deserialize(Archive &archive) {
- NamedObject::deserialize(archive);
- _page = static_cast<GamePage*>(archive.readObject());
- _actions.deserialize(archive);
+ NamedObject::deserialize(archive);
+ _page = static_cast<GamePage*>(archive.readObject());
+ _actions.deserialize(archive);
}
void Actor::toConsole() {
- debug("Actor: _name = %s", _name.c_str());
- for (uint i = 0; i < _actions.size(); ++i) {
- _actions[i]->toConsole();
- }
+ debug("Actor: _name = %s", _name.c_str());
+ for (uint i = 0; i < _actions.size(); ++i) {
+ _actions[i]->toConsole();
+ }
}
Sequencer *Actor::getSequencer() const {
- return _page->getSequencer();
+ return _page->getSequencer();
}
Action *Actor::findAction(const Common::String &name) {
@@ -56,112 +56,112 @@ Action *Actor::findAction(const Common::String &name) {
}
GamePage *Actor::getPage() const {
- return _page;
+ return _page;
}
void Actor::init(bool unk) {
- if (!_action) {
- _action = findAction(kIdleAction);
- }
+ if (!_action) {
+ _action = findAction(kIdleAction);
+ }
- if (!_action) {
- _isActionEnded = 1;
- }
- else {
- _isActionEnded = 0;
- _action->start(unk);
- }
+ if (!_action) {
+ _isActionEnded = 1;
+ }
+ else {
+ _isActionEnded = 0;
+ _action->start(unk);
+ }
}
void Actor::hide() {
- setAction(kHideAction);
+ setAction(kHideAction);
}
void Actor::endAction() {
- _isActionEnded = 1;
+ _isActionEnded = 1;
}
void Actor::setAction(const Common::String &name) {
- Action *newAction = findAction(name);
- setAction(newAction);
+ Action *newAction = findAction(name);
+ setAction(newAction);
}
void Actor::setAction(Action *newAction) {
- if (_action) {
- _isActionEnded = 1;
- _action->end();
- }
- _action = newAction;
- if (newAction) {
- _isActionEnded = 0;
- _action->start(0);
- }
+ if (_action) {
+ _isActionEnded = 1;
+ _action->end();
+ }
+ _action = newAction;
+ if (newAction) {
+ _isActionEnded = 0;
+ _action->start(0);
+ }
}
void Actor::setAction(Action *newAction, bool unk) {
- if (unk) {
- assert(0); // want to see this
- _isActionEnded = 1;
- _action = newAction;
- }
- else {
+ if (unk) {
+ assert(0); // want to see this
+ _isActionEnded = 1;
+ _action = newAction;
+ }
+ else {
setAction(newAction);
}
}
Action *Actor::getAction() const {
- return _action;
+ return _action;
}
bool Actor::isPlaying() {
- return !_isActionEnded;
+ return !_isActionEnded;
}
bool Actor::initPallete(Director *director) {
- for (uint i = 0; i < _actions.size(); ++i) {
- if (_actions[i]->initPalette(director))
- return true;
- }
- return false;
+ for (uint i = 0; i < _actions.size(); ++i) {
+ if (_actions[i]->initPalette(director))
+ return true;
+ }
+ return false;
}
void Actor::onMouseOver(Common::Point point, CursorMgr *mgr) {
- mgr->setCursor(kDefaultCursor, point, Common::String());
+ mgr->setCursor(kDefaultCursor, point, Common::String());
}
Actor::~Actor() {
- for (uint i = 0; i < _actions.size(); ++i) {
- delete _actions[i];
- }
+ for (uint i = 0; i < _actions.size(); ++i) {
+ delete _actions[i];
+ }
}
void Actor::loadState(Archive &archive) {
- Common::String actionName;
- actionName = archive.readString();
- _action = findAction(actionName);
+ Common::String actionName;
+ actionName = archive.readString();
+ _action = findAction(actionName);
}
void Actor::saveState(Archive &archive) {
- Common::String actionName;
+ Common::String actionName;
- if (_action)
- actionName = _action->getName();
+ if (_action)
+ actionName = _action->getName();
- archive.writeString(actionName);
+ archive.writeString(actionName);
}
void Actor::pause() {
- if (_action)
- _action->pause();
+ if (_action)
+ _action->pause();
}
void Actor::unpause() {
- if (_action)
- _action->unpause();
+ if (_action)
+ _action->unpause();
}
void Actor::onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) {
- cursorMgr->setCursor(kHoldingItemCursor, point, itemName);
+ cursorMgr->setCursor(kHoldingItemCursor, point, itemName);
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/actor.h b/engines/pink/objects/actors/actor.h
index b7650a20d0..cfbc358d70 100644
--- a/engines/pink/objects/actors/actor.h
+++ b/engines/pink/objects/actors/actor.h
@@ -39,49 +39,49 @@ class InventoryMgr;
class Actor : public NamedObject {
public:
- Actor()
- : _page(nullptr), _action(nullptr),
- _isActionEnded(1)
- {};
- ~Actor();
- virtual void deserialize(Archive &archive);
+ Actor()
+ : _page(nullptr), _action(nullptr),
+ _isActionEnded(1)
+ {};
+ ~Actor();
+ virtual void deserialize(Archive &archive);
- virtual void toConsole();
+ virtual void toConsole();
- Sequencer *getSequencer() const;
- GamePage *getPage() const;
- Action *getAction() const;
+ Sequencer *getSequencer() const;
+ GamePage *getPage() const;
+ Action *getAction() const;
- bool isPlaying();
- virtual void init(bool unk);
- void hide();
- void endAction();
+ bool isPlaying();
+ virtual void init(bool unk);
+ void hide();
+ void endAction();
- Action *findAction(const Common::String &name);
- void setAction(const Common::String &name);
- void setAction(Action *newAction);
- void setAction(Action *newAction, bool unk);
+ Action *findAction(const Common::String &name);
+ void setAction(const Common::String &name);
+ void setAction(Action *newAction);
+ void setAction(Action *newAction, bool unk);
- void loadState(Archive &archive);
- void saveState(Archive &archive);
+ void loadState(Archive &archive);
+ void saveState(Archive &archive);
- bool initPallete(Director *director);
+ bool initPallete(Director *director);
- virtual void update() {};
+ virtual void update() {};
- virtual void onMouseOver(Common::Point point, CursorMgr *mgr);
- virtual void onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr);
+ virtual void onMouseOver(Common::Point point, CursorMgr *mgr);
+ virtual void onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr);
- virtual bool isClickable() { return 0;}
+ virtual bool isClickable() { return 0;}
- virtual void pause();
- virtual void unpause();
+ virtual void pause();
+ virtual void unpause();
protected:
- GamePage *_page;
- Action *_action;
- Array<Action*> _actions;
- bool _isActionEnded;
+ GamePage *_page;
+ Action *_action;
+ Array<Action*> _actions;
+ bool _isActionEnded;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/audio_info_pda_button.h b/engines/pink/objects/actors/audio_info_pda_button.h
index 63badfd64f..05c8408fe5 100644
--- a/engines/pink/objects/actors/audio_info_pda_button.h
+++ b/engines/pink/objects/actors/audio_info_pda_button.h
@@ -34,20 +34,20 @@ namespace Pink {
class AudioInfoPDAButton : public Actor {
public:
- void toConsole() {
- debug("CursorActor: _name = %s", _name.c_str());
- for (uint i = 0; i < _actions.size(); ++i) {
- _actions[i]->toConsole();
- }
- }
-
- void onMouseOver(Common::Point point, CursorMgr *mgr) override {
- mgr->setCursor(kClickableFirstFrameCursor, point, Common::String());
- }
-
- void onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) override {
- onMouseOver(point, cursorMgr);
- }
+ void toConsole() {
+ debug("CursorActor: _name = %s", _name.c_str());
+ for (uint i = 0; i < _actions.size(); ++i) {
+ _actions[i]->toConsole();
+ }
+ }
+
+ void onMouseOver(Common::Point point, CursorMgr *mgr) override {
+ mgr->setCursor(kClickableFirstFrameCursor, point, Common::String());
+ }
+
+ void onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) override {
+ onMouseOver(point, cursorMgr);
+ }
};
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/cursor_actor.h b/engines/pink/objects/actors/cursor_actor.h
index 7c83a6b289..897728c30c 100644
--- a/engines/pink/objects/actors/cursor_actor.h
+++ b/engines/pink/objects/actors/cursor_actor.h
@@ -33,12 +33,12 @@ namespace Pink {
//same as actor
class CursorActor : public Actor {
public:
- void toConsole() {
- debug("CursorActor: _name = %s", _name.c_str());
- for (uint i = 0; i < _actions.size(); ++i) {
- _actions[i]->toConsole();
- }
- }
+ void toConsole() {
+ debug("CursorActor: _name = %s", _name.c_str());
+ for (uint i = 0; i < _actions.size(); ++i) {
+ _actions[i]->toConsole();
+ }
+ }
};
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/inventory_actor.h b/engines/pink/objects/actors/inventory_actor.h
index 61ebbc4c09..4e6edef5a1 100644
--- a/engines/pink/objects/actors/inventory_actor.h
+++ b/engines/pink/objects/actors/inventory_actor.h
@@ -32,14 +32,14 @@ namespace Pink {
class InventoryActor : public Actor {
public:
- void toConsole() {
- debug("CursorActor: _name = %s", _name.c_str());
- for (uint i = 0; i < _actions.size(); ++i) {
- _actions[i]->toConsole();
- }
- }
-
- void pause() {}
+ void toConsole() {
+ debug("CursorActor: _name = %s", _name.c_str());
+ for (uint i = 0; i < _actions.size(); ++i) {
+ _actions[i]->toConsole();
+ }
+ }
+
+ void pause() {}
};
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index 05d9a763f4..f414cd6e30 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -34,382 +34,382 @@
namespace Pink {
void LeadActor::deserialize(Archive &archive) {
- _state = kReady;
- Actor::deserialize(archive);
- _cursorMgr = static_cast<CursorMgr*>(archive.readObject());
- _walkMgr = static_cast<WalkMgr*>(archive.readObject());
- _sequencer = static_cast<Sequencer*>(archive.readObject());
+ _state = kReady;
+ Actor::deserialize(archive);
+ _cursorMgr = static_cast<CursorMgr*>(archive.readObject());
+ _walkMgr = static_cast<WalkMgr*>(archive.readObject());
+ _sequencer = static_cast<Sequencer*>(archive.readObject());
}
void LeadActor::setNextExecutors(Common::String &nextModule, Common::String &nextPage) {
- if (_state == kReady || _state == kMoving || _state == kInDialog1 || _state == kInventory || _state == kPDA) {
- _state = kPlayingVideo;
- _page->getGame()->setNextExecutors(nextModule, nextPage);
- }
+ 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 == kUnk_Loading){
- _state = kReady;
- }
- _page->getModule()->getInventoryMgr()->setLeadActor(this);
- _page->getGame()->setLeadActor(this);
- Actor::init(unk);
+ if (_state == kUnk_Loading){
+ _state = kReady;
+ }
+ _page->getModule()->getInventoryMgr()->setLeadActor(this);
+ _page->getGame()->setLeadActor(this);
+ Actor::init(unk);
}
void LeadActor::toConsole() {
- debug("LeadActor: _name = %s", _name.c_str());
- for (uint i = 0; i < _actions.size(); ++i) {
- _actions[i]->toConsole();
- }
+ debug("LeadActor: _name = %s", _name.c_str());
+ for (uint i = 0; i < _actions.size(); ++i) {
+ _actions[i]->toConsole();
+ }
}
LeadActor::State LeadActor::getState() const {
- return _state;
+ return _state;
}
void LeadActor::update() {
- switch (_state) {
- case kReady:
- _sequencer->update();
- _cursorMgr->update();
- break;
- case kMoving:
- _walkMgr->update();
- _cursorMgr->update();
- break;
- case kInDialog1:
- case kInDialog2:
- _sequencer->update();
- if (!_sequencer->_context){
- _state = _nextState;
- _nextState = kUnk_Loading;
- }
- break;
-
- case kInventory:
- getPage()->getModule()->getInventoryMgr()->update();
- break;
- case kPDA:
- break;
-
- case kPlayingVideo:
- _sequencer->update();
- if (!_sequencer->_context){
- _state = kUnk_Loading;
- _page->getGame()->changeScene(_page);
- }
- break;
- case kUnk_Loading:
- break;
- }
+ switch (_state) {
+ case kReady:
+ _sequencer->update();
+ _cursorMgr->update();
+ break;
+ case kMoving:
+ _walkMgr->update();
+ _cursorMgr->update();
+ break;
+ case kInDialog1:
+ case kInDialog2:
+ _sequencer->update();
+ if (!_sequencer->_context){
+ _state = _nextState;
+ _nextState = kUnk_Loading;
+ }
+ break;
+
+ case kInventory:
+ getPage()->getModule()->getInventoryMgr()->update();
+ break;
+ case kPDA:
+ break;
+
+ case kPlayingVideo:
+ _sequencer->update();
+ if (!_sequencer->_context){
+ _state = kUnk_Loading;
+ _page->getGame()->changeScene(_page);
+ }
+ break;
+ case kUnk_Loading:
+ break;
+ }
}
void LeadActor::onKeyboardButtonClick(Common::KeyCode code) {
- switch(_state) {
- case kMoving:
- switch (code){
- case Common::KEYCODE_ESCAPE:
- // set unk variables
- // Fall Through intended
- case Common::KEYCODE_SPACE:
- //skip walking animation
- default:
- break;
- }
- break;
- case kInDialog1:
- case kInDialog2:
- case kPlayingVideo:
- switch (code) {
- case Common::KEYCODE_SPACE:
- case Common::KEYCODE_RIGHT:
- _sequencer->skipSubSequence();
- break;
- case Common::KEYCODE_ESCAPE:
- _sequencer->skipToLastSubSequence();
- break;
- case Common::KEYCODE_LEFT:
- _sequencer->restartSequence();
- break;
- default:
- break;
- }
- break;
- default:
- break;
- }
+ switch(_state) {
+ case kMoving:
+ switch (code){
+ case Common::KEYCODE_ESCAPE:
+ // set unk variables
+ // Fall Through intended
+ case Common::KEYCODE_SPACE:
+ //skip walking animation
+ default:
+ break;
+ }
+ break;
+ case kInDialog1:
+ case kInDialog2:
+ case kPlayingVideo:
+ switch (code) {
+ case Common::KEYCODE_SPACE:
+ case Common::KEYCODE_RIGHT:
+ _sequencer->skipSubSequence();
+ break;
+ case Common::KEYCODE_ESCAPE:
+ _sequencer->skipToLastSubSequence();
+ break;
+ case Common::KEYCODE_LEFT:
+ _sequencer->restartSequence();
+ break;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
}
void LeadActor::start(bool isHandler) {
- if (isHandler && _state != kPlayingVideo){
- _state = kInDialog1;
- _nextState = kReady;
- }
- forceUpdateCursor();
+ if (isHandler && _state != kPlayingVideo){
+ _state = kInDialog1;
+ _nextState = kReady;
+ }
+ forceUpdateCursor();
}
void LeadActor::onMouseMove(Common::Point point) {
- if (_state != kPDA)
- updateCursor(point);
- else error("pda is not supported");
+ if (_state != kPDA)
+ updateCursor(point);
+ else error("pda is not supported");
}
void LeadActor::updateCursor(Common::Point point) {
- switch (_state) {
- case kReady:
- case kMoving: {
- Director *director = _page->getGame()->getDirector();
- Actor *actor = director->getActorByPoint(point);
- InventoryItem *item = _page->getModule()->getInventoryMgr()->getCurrentItem();
- if (_isHaveItem) {
- if (actor) {
- actor->onHover(point, item->getName(), _cursorMgr);
- }
- else _cursorMgr->setCursor(kHoldingItemCursor, point, item->getName());
- }
- else if (actor)
- actor->onMouseOver(point, _cursorMgr);
- else _cursorMgr->setCursor(kDefaultCursor, point, Common::String());
- break;
- }
- case kInDialog1:
- case kInDialog2:
- case kPlayingVideo:
- _cursorMgr->setCursor(kNotClickableCursor, point, Common::String());
- break;
- case kPDA:
- case kInventory:
- _cursorMgr->setCursor(kDefaultCursor, point, Common::String());
- break;
- default:
- break;
- }
+ switch (_state) {
+ case kReady:
+ case kMoving: {
+ Director *director = _page->getGame()->getDirector();
+ Actor *actor = director->getActorByPoint(point);
+ InventoryItem *item = _page->getModule()->getInventoryMgr()->getCurrentItem();
+ if (_isHaveItem) {
+ if (actor) {
+ actor->onHover(point, item->getName(), _cursorMgr);
+ }
+ else _cursorMgr->setCursor(kHoldingItemCursor, point, item->getName());
+ }
+ else if (actor)
+ actor->onMouseOver(point, _cursorMgr);
+ else _cursorMgr->setCursor(kDefaultCursor, point, Common::String());
+ break;
+ }
+ case kInDialog1:
+ case kInDialog2:
+ case kPlayingVideo:
+ _cursorMgr->setCursor(kNotClickableCursor, point, Common::String());
+ break;
+ case kPDA:
+ case kInventory:
+ _cursorMgr->setCursor(kDefaultCursor, point, Common::String());
+ break;
+ default:
+ break;
+ }
}
void LeadActor::onLeftButtonClick(Common::Point point) {
- InventoryMgr *invMgr = _page->getModule()->getInventoryMgr();
-
- switch (_state) {
- case kReady:
- case kMoving: {
- Actor *actor = _page->getGame()->getDirector()->getActorByPoint(point);
-
- if (this == actor) {
- onClick();
- return;
- }
-
- _recipient = dynamic_cast<SupportingActor*>(actor);
- if (actor->isClickable() && isInteractingWith(_recipient)) {
- WalkLocation *location = getWalkDestination();
- if (location) {
- _state = kMoving;
- _nextState = kInDialog1;
- _walkMgr->start(location);
- }
- else if (_state == kReady){
- if (_isHaveItem)
- sendUseClickMessage(_recipient);
- else sendLeftClickMessage(_recipient);
- }
- }
-
- break;
- }
- case kPDA:
-
- break;
- case kInventory:
- invMgr->onClick(point);
- break;
- default:
- break;
- }
+ InventoryMgr *invMgr = _page->getModule()->getInventoryMgr();
+
+ switch (_state) {
+ case kReady:
+ case kMoving: {
+ Actor *actor = _page->getGame()->getDirector()->getActorByPoint(point);
+
+ if (this == actor) {
+ onClick();
+ return;
+ }
+
+ _recipient = dynamic_cast<SupportingActor*>(actor);
+ if (actor->isClickable() && isInteractingWith(_recipient)) {
+ WalkLocation *location = getWalkDestination();
+ if (location) {
+ _state = kMoving;
+ _nextState = kInDialog1;
+ _walkMgr->start(location);
+ }
+ else if (_state == kReady){
+ if (_isHaveItem)
+ sendUseClickMessage(_recipient);
+ else sendLeftClickMessage(_recipient);
+ }
+ }
+
+ break;
+ }
+ case kPDA:
+
+ break;
+ case kInventory:
+ invMgr->onClick(point);
+ break;
+ default:
+ break;
+ }
}
void LeadActor::onMouseOver(Common::Point point, CursorMgr *mgr) {
- if (_page->getModule()->getInventoryMgr()->isPinkOwnsAnyItems())
- _cursorMgr->setCursor(kClickableFirstFrameCursor, point, Common::String());
- else Actor::onMouseOver(point, mgr);
+ if (_page->getModule()->getInventoryMgr()->isPinkOwnsAnyItems())
+ _cursorMgr->setCursor(kClickableFirstFrameCursor, point, Common::String());
+ else Actor::onMouseOver(point, mgr);
}
void LeadActor::onWalkEnd() {
- State oldNextState = _nextState;
- _state = kReady;
- _nextState = kUnk_Loading;
- if (_recipient && oldNextState == kInDialog1){
- if (_isHaveItem)
- sendUseClickMessage(_recipient);
- else sendLeftClickMessage(_recipient);
- }
+ State oldNextState = _nextState;
+ _state = kReady;
+ _nextState = kUnk_Loading;
+ if (_recipient && oldNextState == kInDialog1){
+ if (_isHaveItem)
+ sendUseClickMessage(_recipient);
+ else sendLeftClickMessage(_recipient);
+ }
}
bool LeadActor::sendUseClickMessage(SupportingActor *actor) {
- InventoryMgr *mgr = _page->getModule()->getInventoryMgr();
- _nextState = _state != kPlayingVideo ? kReady : kPlayingVideo;
- _state = kInDialog1;
- InventoryItem *item = mgr->getCurrentItem();
- actor->onUseClickMessage(mgr->getCurrentItem(), mgr);
- if (item->getCurrentOwner() != this->_name)
- _isHaveItem = false;
- return true;
+ InventoryMgr *mgr = _page->getModule()->getInventoryMgr();
+ _nextState = _state != kPlayingVideo ? kReady : kPlayingVideo;
+ _state = kInDialog1;
+ InventoryItem *item = mgr->getCurrentItem();
+ actor->onUseClickMessage(mgr->getCurrentItem(), mgr);
+ if (item->getCurrentOwner() != this->_name)
+ _isHaveItem = false;
+ return true;
}
bool LeadActor::sendLeftClickMessage(SupportingActor *actor) {
- _nextState = _state != kPlayingVideo ? kReady : kPlayingVideo;
- _state = kInDialog1;
- return actor->onLeftClickMessage();
+ _nextState = _state != kPlayingVideo ? kReady : kPlayingVideo;
+ _state = kInDialog1;
+ return actor->onLeftClickMessage();
}
void LeadActor::onClick() {
- if (_isHaveItem) {
- _isHaveItem = false;
- _nextState = (_state != kMoving) ?
- kUnk_Loading : kReady;
- }
- else {
- if (_state == kMoving) {
- _recipient = nullptr;
- _nextState = kReady;
- }
- if (_page->getModule()->getInventoryMgr()->start(1)){
- _stateCopy = _state;
- _state = kInventory;
- _page->pause();
- }
- }
+ if (_isHaveItem) {
+ _isHaveItem = false;
+ _nextState = (_state != kMoving) ?
+ kUnk_Loading : kReady;
+ }
+ else {
+ if (_state == kMoving) {
+ _recipient = nullptr;
+ _nextState = kReady;
+ }
+ if (_page->getModule()->getInventoryMgr()->start(1)){
+ _stateCopy = _state;
+ _state = kInventory;
+ _page->pause();
+ }
+ }
}
LeadActor::LeadActor()
- : _state(kReady), _nextState(kReady),
- _isHaveItem(false), _recipient(nullptr),
- _cursorMgr(nullptr), _walkMgr(nullptr),
- _sequencer(nullptr)
+ : _state(kReady), _nextState(kReady),
+ _isHaveItem(false), _recipient(nullptr),
+ _cursorMgr(nullptr), _walkMgr(nullptr),
+ _sequencer(nullptr)
{}
void LeadActor::onInventoryClosed(bool isItemClicked) {
- _isHaveItem = isItemClicked;
- _state = _stateCopy;
- _stateCopy = kUnk_Loading;
- _page->unpause();
- forceUpdateCursor();
+ _isHaveItem = isItemClicked;
+ _state = _stateCopy;
+ _stateCopy = kUnk_Loading;
+ _page->unpause();
+ forceUpdateCursor();
}
void LeadActor::forceUpdateCursor() {
- Common::Point point = _page->getGame()->getEventManager()->getMousePos();
- updateCursor(point);
+ Common::Point point = _page->getGame()->getEventManager()->getMousePos();
+ updateCursor(point);
}
WalkLocation *LeadActor::getWalkDestination() {
- return _walkMgr->findLocation(_recipient->getLocation());
+ return _walkMgr->findLocation(_recipient->getLocation());
}
bool LeadActor::isInteractingWith(SupportingActor *actor) {
- if (!_isHaveItem)
- return actor->isLeftClickHandlers();
+ if (!_isHaveItem)
+ return actor->isLeftClickHandlers();
- return actor->isUseClickHandlers(_page->getModule()->getInventoryMgr()->getCurrentItem());
+ return actor->isUseClickHandlers(_page->getModule()->getInventoryMgr()->getCurrentItem());
}
void ParlSqPink::toConsole() {
- debug("ParlSqPink: _name = %s", _name.c_str());
- for (uint i = 0; i < _actions.size(); ++i) {
- _actions[i]->toConsole();
- }
+ debug("ParlSqPink: _name = %s", _name.c_str());
+ for (uint i = 0; i < _actions.size(); ++i) {
+ _actions[i]->toConsole();
+ }
}
WalkLocation *ParlSqPink::getWalkDestination() {
- if (_recipient->getName() == kBoy &&
- _page->checkValueOfVariable(kBoyBlocked, kUndefined))
- {
- return _walkMgr->findLocation(kSirBaldley);
- }
- return LeadActor::getWalkDestination();
+ if (_recipient->getName() == kBoy &&
+ _page->checkValueOfVariable(kBoyBlocked, kUndefined))
+ {
+ return _walkMgr->findLocation(kSirBaldley);
+ }
+ return LeadActor::getWalkDestination();
}
PubPink::PubPink() :
- LeadActor(), _round(0)
+ LeadActor(), _round(0)
{}
void PubPink::toConsole() {
- debug("PubPink: _name = %s", _name.c_str());
- for (uint i = 0; i < _actions.size(); ++i) {
- _actions[i]->toConsole();
- }
+ debug("PubPink: _name = %s", _name.c_str());
+ for (uint i = 0; i < _actions.size(); ++i) {
+ _actions[i]->toConsole();
+ }
}
bool PubPink::playingMiniGame() {
- return !(_page->checkValueOfVariable(kFoodPuzzle, "TRUE") ||
- _page->checkValueOfVariable(kFoodPuzzle, kUndefined));
+ return !(_page->checkValueOfVariable(kFoodPuzzle, "TRUE") ||
+ _page->checkValueOfVariable(kFoodPuzzle, kUndefined));
}
void PubPink::onClick() {
- if (!playingMiniGame())
- LeadActor::onClick();
+ if (!playingMiniGame())
+ LeadActor::onClick();
}
void PubPink::updateCursor(Common::Point point) {
- if (playingMiniGame()) {
- SupportingActor *actor = dynamic_cast<SupportingActor*>(_page->getGame()->getDirector()->getActorByPoint(point));
- if (_state == kReady &&
- actor &&
- actor->isUseClickHandlers(_page->getModule()->getInventoryMgr()->getCurrentItem()))
- {
- _cursorMgr->setCursor(kClickableFirstFrameCursor, point, Common::String());
- }
- else _cursorMgr->setCursor(kDefaultCursor, point, Common::String());
- }
- else LeadActor::updateCursor(point);
+ if (playingMiniGame()) {
+ SupportingActor *actor = dynamic_cast<SupportingActor*>(_page->getGame()->getDirector()->getActorByPoint(point));
+ if (_state == kReady &&
+ actor &&
+ actor->isUseClickHandlers(_page->getModule()->getInventoryMgr()->getCurrentItem()))
+ {
+ _cursorMgr->setCursor(kClickableFirstFrameCursor, point, Common::String());
+ }
+ else _cursorMgr->setCursor(kDefaultCursor, point, Common::String());
+ }
+ else LeadActor::updateCursor(point);
}
WalkLocation *PubPink::getWalkDestination() {
- if (playingMiniGame())
- return nullptr;
+ if (playingMiniGame())
+ return nullptr;
- if (_recipient->getName() == kJackson &&
- !_page->checkValueOfVariable(kDrunkLocation, kBolted))
- {
- return _walkMgr->findLocation(_page->findActor(kDrunk)->getName());
- }
+ if (_recipient->getName() == kJackson &&
+ !_page->checkValueOfVariable(kDrunkLocation, kBolted))
+ {
+ return _walkMgr->findLocation(_page->findActor(kDrunk)->getName());
+ }
- return LeadActor::getWalkDestination();
+ return LeadActor::getWalkDestination();
}
bool PubPink::sendUseClickMessage(SupportingActor *actor) {
if (!LeadActor::sendUseClickMessage(actor) &&
- playingMiniGame()) {
- _nextState = _state;
- _state = kInDialog1;
-
- const char *roundName;
- switch (_round++ % 3) {
- case 0:
- roundName = kFirstRound;
- break;
- case 1:
- roundName = kSecondRound;
- break;
- case 2:
- roundName = kThirdRound;
- break;
- default:
- roundName = nullptr;
- assert(0);
- break;
- }
- _sequencer->authorSequence(_sequencer->findSequence(roundName), 0);
+ playingMiniGame()) {
+ _nextState = _state;
+ _state = kInDialog1;
+
+ const char *roundName;
+ switch (_round++ % 3) {
+ case 0:
+ roundName = kFirstRound;
+ break;
+ case 1:
+ roundName = kSecondRound;
+ break;
+ case 2:
+ roundName = kThirdRound;
+ break;
+ default:
+ roundName = nullptr;
+ assert(0);
+ break;
+ }
+ _sequencer->authorSequence(_sequencer->findSequence(roundName), 0);
}
if (playingMiniGame())
- _isHaveItem = true;
+ _isHaveItem = true;
return true;
}
void PubPink::onVariableSet() {
- if (playingMiniGame())
- _isHaveItem = true;
+ if (playingMiniGame())
+ _isHaveItem = true;
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/lead_actor.h b/engines/pink/objects/actors/lead_actor.h
index b6f91acabf..7dff2e86df 100644
--- a/engines/pink/objects/actors/lead_actor.h
+++ b/engines/pink/objects/actors/lead_actor.h
@@ -40,89 +40,89 @@ class InventoryItem;
class LeadActor : public Actor {
public:
- LeadActor();
- enum State {
- kReady = 0,
- kMoving = 1,
- kInDialog1 = 2, //???
- kInventory = 3,
- kPDA = 4,
- kInDialog2 = 5,//???
- kPlayingVideo = 6, // ???
- kUnk_Loading = 7// ????
- };
+ LeadActor();
+ enum State {
+ kReady = 0,
+ kMoving = 1,
+ kInDialog1 = 2, //???
+ kInventory = 3,
+ kPDA = 4,
+ kInDialog2 = 5,//???
+ kPlayingVideo = 6, // ???
+ kUnk_Loading = 7// ????
+ };
- virtual void deserialize(Archive &archive);
+ virtual void deserialize(Archive &archive);
- virtual void toConsole();
+ virtual void toConsole();
- void setNextExecutors (Common::String &nextModule, Common::String &nextPage);
- virtual void init(bool unk);
+ void setNextExecutors (Common::String &nextModule, Common::String &nextPage);
+ virtual void init(bool unk);
- State getState() const;
+ State getState() const;
- void start(bool isHandler);
- void update();
+ void start(bool isHandler);
+ void update();
- void onKeyboardButtonClick(Common::KeyCode code);
- void onLeftButtonClick(Common::Point point);
- void onMouseMove(Common::Point point);
- void onWalkEnd();
- virtual void onClick();
- void onInventoryClosed(bool isItemClicked);
- virtual void onVariableSet() {};
+ void onKeyboardButtonClick(Common::KeyCode code);
+ void onLeftButtonClick(Common::Point point);
+ void onMouseMove(Common::Point point);
+ void onWalkEnd();
+ virtual void onClick();
+ void onInventoryClosed(bool isItemClicked);
+ virtual void onVariableSet() {};
- virtual void onMouseOver(Common::Point point, CursorMgr *mgr);
+ virtual void onMouseOver(Common::Point point, CursorMgr *mgr);
- bool isInteractingWith(SupportingActor *actor);
+ bool isInteractingWith(SupportingActor *actor);
protected:
- virtual void updateCursor(Common::Point point);
- void forceUpdateCursor();
+ virtual void updateCursor(Common::Point point);
+ void forceUpdateCursor();
- virtual bool sendUseClickMessage(SupportingActor *actor);
- bool sendLeftClickMessage(SupportingActor *actor);
+ virtual bool sendUseClickMessage(SupportingActor *actor);
+ bool sendLeftClickMessage(SupportingActor *actor);
- virtual WalkLocation *getWalkDestination();
+ virtual WalkLocation *getWalkDestination();
- State _state;
- State _nextState;
- State _stateCopy;
+ State _state;
+ State _nextState;
+ State _stateCopy;
- bool _isHaveItem;
+ bool _isHaveItem;
- SupportingActor *_recipient;
+ SupportingActor *_recipient;
- CursorMgr *_cursorMgr;
- WalkMgr *_walkMgr;
- Sequencer *_sequencer;
+ CursorMgr *_cursorMgr;
+ WalkMgr *_walkMgr;
+ Sequencer *_sequencer;
};
class ParlSqPink : public LeadActor {
public:
- virtual WalkLocation *getWalkDestination();
- void toConsole();
+ virtual WalkLocation *getWalkDestination();
+ void toConsole();
};
class PubPink : public LeadActor {
public:
- PubPink();
+ PubPink();
- void toConsole();
+ void toConsole();
- virtual void onClick();
- virtual void onVariableSet();
+ virtual void onClick();
+ virtual void onVariableSet();
private:
- int _round;
+ int _round;
- virtual bool sendUseClickMessage(SupportingActor *actor);
- virtual void updateCursor(Common::Point point);
- virtual WalkLocation *getWalkDestination();
+ virtual bool sendUseClickMessage(SupportingActor *actor);
+ virtual void updateCursor(Common::Point point);
+ virtual WalkLocation *getWalkDestination();
- bool playingMiniGame();
+ bool playingMiniGame();
};
diff --git a/engines/pink/objects/actors/pda_button_actor.cpp b/engines/pink/objects/actors/pda_button_actor.cpp
index 1057a060e4..65e3f7ba21 100644
--- a/engines/pink/objects/actors/pda_button_actor.cpp
+++ b/engines/pink/objects/actors/pda_button_actor.cpp
@@ -25,18 +25,18 @@
namespace Pink {
void PDAButtonActor::deserialize(Archive &archive) {
- Actor::deserialize(archive);
- _hideOnStop = (bool) archive.readDWORD();
- _opaque = (bool) archive.readDWORD();
+ Actor::deserialize(archive);
+ _hideOnStop = (bool) archive.readDWORD();
+ _opaque = (bool) archive.readDWORD();
- int comm = archive.readDWORD();
- assert(comm <= 4);
- _command = (Command) comm;
+ int comm = archive.readDWORD();
+ assert(comm <= 4);
+ _command = (Command) comm;
}
void PDAButtonActor::toConsole() {
- debug("PDAButtonActor: _name = %s, _x = %u _y = %u _hideOnStop = %u, _opaque = %u, _command = %u",
- _name.c_str(), _x, _y, _hideOnStop, _opaque, (int) _command);
+ debug("PDAButtonActor: _name = %s, _x = %u _y = %u _hideOnStop = %u, _opaque = %u, _command = %u",
+ _name.c_str(), _x, _y, _hideOnStop, _opaque, (int) _command);
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/pda_button_actor.h b/engines/pink/objects/actors/pda_button_actor.h
index c3cd845886..5e7d53b4b4 100644
--- a/engines/pink/objects/actors/pda_button_actor.h
+++ b/engines/pink/objects/actors/pda_button_actor.h
@@ -29,19 +29,19 @@ namespace Pink {
class PDAButtonActor : public Actor {
public:
- enum Command {Null = 0, GoToPage = 1, Close = 2, Unk = 4};
+ enum Command {Null = 0, GoToPage = 1, Close = 2, Unk = 4};
- void deserialize(Archive &archive) override;
- void toConsole() override;
+ void deserialize(Archive &archive) override;
+ void toConsole() override;
private:
- int _x;
- int _y;
+ int _x;
+ int _y;
- bool _hideOnStop;
- bool _opaque;
+ bool _hideOnStop;
+ bool _opaque;
- Command _command;
+ Command _command;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/supporting_actor.cpp b/engines/pink/objects/actors/supporting_actor.cpp
index 9c06dee3fc..3ba10366ed 100644
--- a/engines/pink/objects/actors/supporting_actor.cpp
+++ b/engines/pink/objects/actors/supporting_actor.cpp
@@ -30,64 +30,64 @@
namespace Pink {
void SupportingActor::deserialize(Archive &archive) {
- Actor::deserialize(archive);
- _location = archive.readString();
- _pdaLink = archive.readString();
- _cursor = archive.readString();
- _handlerMgr.deserialize(archive);
+ Actor::deserialize(archive);
+ _location = archive.readString();
+ _pdaLink = archive.readString();
+ _cursor = archive.readString();
+ _handlerMgr.deserialize(archive);
}
void SupportingActor::toConsole() {
- debug("SupportingActor: _name = %s, _location=%s, _pdaLink=%s, _cursor=%s",
- _name.c_str(), _location.c_str(), _pdaLink.c_str(), _cursor.c_str());
- for (uint i = 0; i < _actions.size(); ++i) {
- _actions[i]->toConsole();
- }
- _handlerMgr.toConsole();
+ debug("SupportingActor: _name = %s, _location=%s, _pdaLink=%s, _cursor=%s",
+ _name.c_str(), _location.c_str(), _pdaLink.c_str(), _cursor.c_str());
+ for (uint i = 0; i < _actions.size(); ++i) {
+ _actions[i]->toConsole();
+ }
+ _handlerMgr.toConsole();
}
void SupportingActor::onMouseOver(Common::Point point, CursorMgr *mgr) {
- if (isLeftClickHandlers()){
- if (!_cursor.empty()){
- mgr->setCursor(_cursor, point);
- }
- else mgr->setCursor(kClickableFirstFrameCursor, point, Common::String());
- }
- else Actor::onMouseOver(point, mgr);
+ if (isLeftClickHandlers()){
+ if (!_cursor.empty()){
+ mgr->setCursor(_cursor, point);
+ }
+ else mgr->setCursor(kClickableFirstFrameCursor, point, Common::String());
+ }
+ else Actor::onMouseOver(point, mgr);
}
bool SupportingActor::isLeftClickHandlers() {
- return _handlerMgr.isLeftClickHandler(this);
+ return _handlerMgr.isLeftClickHandler(this);
}
bool SupportingActor::isUseClickHandlers(InventoryItem *item) {
- return _handlerMgr.isUseClickHandler(this, item->getName());
+ return _handlerMgr.isUseClickHandler(this, item->getName());
}
void SupportingActor::onTimerMessage() {
- _handlerMgr.onTimerMessage(this);
+ _handlerMgr.onTimerMessage(this);
}
bool SupportingActor::onLeftClickMessage() {
- return _handlerMgr.onLeftClickMessage(this);
+ return _handlerMgr.onLeftClickMessage(this);
}
bool SupportingActor::onUseClickMessage(InventoryItem *item, InventoryMgr *mgr) {
- return _handlerMgr.onUseClickMessage(this, item, mgr);
+ return _handlerMgr.onUseClickMessage(this, item, mgr);
}
const Common::String &SupportingActor::getLocation() const {
- return _location;
+ return _location;
}
SupportingActor::~SupportingActor() {}
void SupportingActor::onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) {
- Common::String item = itemName;
- if (_handlerMgr.isUseClickHandler(this, itemName)) {
- item += kClickable;
- }
- Actor::onHover(point, item, cursorMgr);
+ Common::String item = itemName;
+ if (_handlerMgr.isUseClickHandler(this, itemName)) {
+ item += kClickable;
+ }
+ Actor::onHover(point, item, cursorMgr);
}
} // End of namespace Pink
diff --git a/engines/pink/objects/actors/supporting_actor.h b/engines/pink/objects/actors/supporting_actor.h
index eecee3a642..d47959dfa9 100644
--- a/engines/pink/objects/actors/supporting_actor.h
+++ b/engines/pink/objects/actors/supporting_actor.h
@@ -33,30 +33,30 @@ class InventoryMgr;
class SupportingActor : public Actor {
public:
- virtual ~SupportingActor();
- virtual void deserialize(Archive &archive);
- virtual void toConsole();
+ virtual ~SupportingActor();
+ virtual void deserialize(Archive &archive);
+ virtual void toConsole();
- virtual void onMouseOver(Common::Point point, CursorMgr *mgr);
+ virtual void onMouseOver(Common::Point point, CursorMgr *mgr);
- virtual bool isClickable() { return 1; }
- bool isLeftClickHandlers();
- bool isUseClickHandlers(InventoryItem *item);
+ virtual bool isClickable() { return 1; }
+ bool isLeftClickHandlers();
+ bool isUseClickHandlers(InventoryItem *item);
- void onTimerMessage();
- bool onLeftClickMessage();
- bool onUseClickMessage(InventoryItem *item, InventoryMgr *mgr);
+ void onTimerMessage();
+ bool onLeftClickMessage();
+ bool onUseClickMessage(InventoryItem *item, InventoryMgr *mgr);
- virtual void onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr);
+ virtual void onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr);
- const Common::String &getLocation() const;
+ const Common::String &getLocation() const;
private:
- HandlerMgr _handlerMgr;
- Common::String _location;
- Common::String _pdaLink;
- Common::String _cursor;
+ HandlerMgr _handlerMgr;
+ Common::String _location;
+ Common::String _pdaLink;
+ Common::String _cursor;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/condition.cpp b/engines/pink/objects/condition.cpp
index 4e0b3760b8..abb955028b 100644
--- a/engines/pink/objects/condition.cpp
+++ b/engines/pink/objects/condition.cpp
@@ -29,71 +29,71 @@
namespace Pink {
void Pink::ConditionVariable::deserialize(Archive &archive) {
- _name = archive.readString();
- _value = archive.readString();
+ _name = archive.readString();
+ _value = archive.readString();
}
bool Pink::ConditionGameVariable::evaluate(Actor *actor) {
- return actor->getPage()->getModule()->getGame()->checkValueOfVariable(_name, _value);
+ return actor->getPage()->getModule()->getGame()->checkValueOfVariable(_name, _value);
}
void ConditionGameVariable::toConsole() {
- debug("\t\tConditionGameVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
+ debug("\t\tConditionGameVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
}
bool Pink::ConditionModuleVariable::evaluate(Actor *actor) {
- return actor->getPage()->getModule()->checkValueOfVariable(_name, _value);
+ return actor->getPage()->getModule()->checkValueOfVariable(_name, _value);
}
void ConditionModuleVariable::toConsole() {
- debug("\t\tConditionModuleVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
+ debug("\t\tConditionModuleVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
}
bool Pink::ConditionNotModuleVariable::evaluate(Actor *actor) {
- return !ConditionModuleVariable::evaluate(actor);
+ return !ConditionModuleVariable::evaluate(actor);
}
void ConditionNotModuleVariable::toConsole() {
- debug("\t\tConditionNotModuleVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
+ debug("\t\tConditionNotModuleVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
}
bool ConditionPageVariable::evaluate(Actor *actor) {
- return actor->getPage()->checkValueOfVariable(_name, _value);
+ return actor->getPage()->checkValueOfVariable(_name, _value);
}
void ConditionPageVariable::toConsole() {
- debug("\t\tConditionPageVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
+ debug("\t\tConditionPageVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
}
bool ConditionNotPageVariable::evaluate(Actor *actor) {
- return !ConditionPageVariable::evaluate(actor);
+ return !ConditionPageVariable::evaluate(actor);
}
void ConditionNotPageVariable::toConsole() {
- debug("\t\tConditionNotPageVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
+ debug("\t\tConditionNotPageVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
}
void ConditionInventoryItemOwner::deserialize(Archive &archive) {
- _item = archive.readString();
- _owner = archive.readString();
+ _item = archive.readString();
+ _owner = archive.readString();
}
bool ConditionInventoryItemOwner::evaluate(Actor *actor) {
- InventoryMgr *mgr = actor->getPage()->getModule()->getInventoryMgr();
- InventoryItem *item = mgr->findInventoryItem(_item);
- return item->getCurrentOwner() == _owner;
+ InventoryMgr *mgr = actor->getPage()->getModule()->getInventoryMgr();
+ InventoryItem *item = mgr->findInventoryItem(_item);
+ return item->getCurrentOwner() == _owner;
}
void ConditionInventoryItemOwner::toConsole() {
- debug("\t\tConditionInventoryItemOwner: _item=%s, _owner=%s", _item.c_str(), _owner.c_str());
+ debug("\t\tConditionInventoryItemOwner: _item=%s, _owner=%s", _item.c_str(), _owner.c_str());
}
bool ConditionNotInventoryItemOwner::evaluate(Actor *actor) {
- return !ConditionInventoryItemOwner::evaluate(actor);
+ return !ConditionInventoryItemOwner::evaluate(actor);
}
void ConditionNotInventoryItemOwner::toConsole() {
- debug("\t\tConditionNotInventoryItemOwner: _item=%s, _owner=%s", _item.c_str(), _owner.c_str());
+ debug("\t\tConditionNotInventoryItemOwner: _item=%s, _owner=%s", _item.c_str(), _owner.c_str());
}
} // End of namespace Pink
diff --git a/engines/pink/objects/condition.h b/engines/pink/objects/condition.h
index 505ed2d58d..ff5a6fb793 100644
--- a/engines/pink/objects/condition.h
+++ b/engines/pink/objects/condition.h
@@ -31,73 +31,73 @@ class Actor;
class Condition : public Object {
public:
- virtual void deserialize(Archive &archive) = 0;
- virtual bool evaluate(Actor *actor) = 0;
+ virtual void deserialize(Archive &archive) = 0;
+ virtual bool evaluate(Actor *actor) = 0;
};
class ConditionVariable : public Condition {
public:
- virtual void deserialize(Archive &archive);
- virtual bool evaluate(Actor *actor) = 0;
+ virtual void deserialize(Archive &archive);
+ virtual bool evaluate(Actor *actor) = 0;
protected:
- Common::String _name;
- Common::String _value;
+ Common::String _name;
+ Common::String _value;
};
class ConditionGameVariable : public ConditionVariable {
public:
- virtual void toConsole();
- virtual bool evaluate(Actor *actor);
+ virtual void toConsole();
+ virtual bool evaluate(Actor *actor);
};
/*
* It is not used in games and has evaluate method with infinity recursion
class ConditionNotGameVariable : public ConditionGameVariable {
- virtual bool evaluate(LeadActor *leadActor);
+ virtual bool evaluate(LeadActor *leadActor);
};
*/
class ConditionModuleVariable : public ConditionVariable {
public:
- virtual void toConsole();
- virtual bool evaluate(Actor *actor);
+ virtual void toConsole();
+ virtual bool evaluate(Actor *actor);
};
class ConditionNotModuleVariable : public ConditionModuleVariable {
public:
- virtual void toConsole();
- virtual bool evaluate(Actor *actor);
+ virtual void toConsole();
+ virtual bool evaluate(Actor *actor);
};
class ConditionPageVariable : public ConditionVariable {
public:
- virtual void toConsole();
- virtual bool evaluate(Actor *actor);
+ virtual void toConsole();
+ virtual bool evaluate(Actor *actor);
};
class ConditionNotPageVariable : public ConditionPageVariable {
public:
- virtual void toConsole();
- virtual bool evaluate(Actor *actor);
+ virtual void toConsole();
+ virtual bool evaluate(Actor *actor);
};
class ConditionInventoryItemOwner : public Condition {
public:
- virtual void toConsole();
- virtual void deserialize(Archive &archive);
- virtual bool evaluate(Actor *actor);
+ virtual void toConsole();
+ virtual void deserialize(Archive &archive);
+ virtual bool evaluate(Actor *actor);
protected:
- Common::String _item;
- Common::String _owner;
+ Common::String _item;
+ Common::String _owner;
};
class ConditionNotInventoryItemOwner : public ConditionInventoryItemOwner {
public:
- virtual void toConsole();
- virtual bool evaluate(Actor *actor);
+ virtual void toConsole();
+ virtual bool evaluate(Actor *actor);
};
} // End of namespace Pink
diff --git a/engines/pink/objects/handlers/handler.cpp b/engines/pink/objects/handlers/handler.cpp
index 8833153e0c..2f73553f2a 100644
--- a/engines/pink/objects/handlers/handler.cpp
+++ b/engines/pink/objects/handlers/handler.cpp
@@ -34,123 +34,123 @@ namespace Pink {
void Handler::deserialize(Archive &archive) {
_conditions.deserialize(archive);
- _sideEffects.deserialize(archive);
+ _sideEffects.deserialize(archive);
}
bool Handler::isSuitable(Actor *actor) {
- for (uint i = 0; i < _conditions.size(); ++i) {
- if (!_conditions[i]->evaluate(actor)){
- return false;
- }
- }
- return true;
+ for (uint i = 0; i < _conditions.size(); ++i) {
+ if (!_conditions[i]->evaluate(actor)){
+ return false;
+ }
+ }
+ return true;
}
void Handler::executeSideEffects(Actor *actor) {
- for (uint i = 0; i < _sideEffects.size(); ++i) {
- _sideEffects[i]->execute(actor);
- }
+ for (uint i = 0; i < _sideEffects.size(); ++i) {
+ _sideEffects[i]->execute(actor);
+ }
}
void Handler::handle(Actor *actor) {
- executeSideEffects(actor);
+ executeSideEffects(actor);
}
Handler::~Handler() {
- for (uint i = 0; i < _sideEffects.size(); ++i) {
- delete _sideEffects[i];
- }
- for (uint i = 0; i < _conditions.size(); ++i) {
- delete _conditions[i];
- }
+ for (uint i = 0; i < _sideEffects.size(); ++i) {
+ delete _sideEffects[i];
+ }
+ for (uint i = 0; i < _conditions.size(); ++i) {
+ delete _conditions[i];
+ }
}
void HandlerSequences::deserialize(Archive &archive) {
- Handler::deserialize(archive);
- _sequences.deserialize(archive);
+ Handler::deserialize(archive);
+ _sequences.deserialize(archive);
}
void HandlerSequences::handle(Actor *actor) {
- Handler::handle(actor);
- Sequencer *sequencer = actor->getSequencer();
+ Handler::handle(actor);
+ Sequencer *sequencer = actor->getSequencer();
- assert(!_sequences.empty());
+ assert(!_sequences.empty());
- Common::RandomSource &rnd = actor->getPage()->getGame()->getRnd();
- uint index = rnd.getRandomNumber(_sequences.size() - 1);
+ Common::RandomSource &rnd = actor->getPage()->getGame()->getRnd();
+ uint index = rnd.getRandomNumber(_sequences.size() - 1);
- Sequence *sequence = sequencer->findSequence(_sequences[index]);
+ Sequence *sequence = sequencer->findSequence(_sequences[index]);
- assert(sequence);
- sequencer->authorSequence(sequence, 0);
+ assert(sequence);
+ sequencer->authorSequence(sequence, 0);
- execute(sequence);
+ execute(sequence);
}
void HandlerStartPage::execute(Sequence *sequence) {
- sequence->_unk = 1;
+ sequence->_unk = 1;
}
void HandlerStartPage::toConsole() {
- debug("HandlerStartPage:");
-
- debug("\tSideEffects:");
- for (uint i = 0; i < _sideEffects.size(); ++i) {
- _sideEffects[i]->toConsole();
- }
-
- debug("\tConditions:");
- for (uint i = 0; i < _conditions.size(); ++i) {
- _conditions[i]->toConsole();
- }
-
- debug("\tSequences:");
- for (uint i = 0; i < _sequences.size(); ++i) {
- debug("\t\t%s", _sequences[i].c_str());
- }
+ debug("HandlerStartPage:");
+
+ debug("\tSideEffects:");
+ for (uint i = 0; i < _sideEffects.size(); ++i) {
+ _sideEffects[i]->toConsole();
+ }
+
+ debug("\tConditions:");
+ for (uint i = 0; i < _conditions.size(); ++i) {
+ _conditions[i]->toConsole();
+ }
+
+ debug("\tSequences:");
+ for (uint i = 0; i < _sequences.size(); ++i) {
+ debug("\t\t%s", _sequences[i].c_str());
+ }
}
void HandlerLeftClick::toConsole() {
- debug("HandlerLeftClick:");
-
- debug("\tSideEffects:");
- for (uint i = 0; i < _sideEffects.size(); ++i) {
- _sideEffects[i]->toConsole();
- }
-
- debug("\tConditions:");
- for (uint i = 0; i < _conditions.size(); ++i) {
- _conditions[i]->toConsole();
- }
-
- debug("\tSequences:");
- for (uint i = 0; i < _sequences.size(); ++i) {
- debug("\t\t%s", _sequences[i].c_str());
- }
+ debug("HandlerLeftClick:");
+
+ debug("\tSideEffects:");
+ for (uint i = 0; i < _sideEffects.size(); ++i) {
+ _sideEffects[i]->toConsole();
+ }
+
+ debug("\tConditions:");
+ for (uint i = 0; i < _conditions.size(); ++i) {
+ _conditions[i]->toConsole();
+ }
+
+ debug("\tSequences:");
+ for (uint i = 0; i < _sequences.size(); ++i) {
+ debug("\t\t%s", _sequences[i].c_str());
+ }
}
void HandlerUseClick::deserialize(Archive &archive) {
- HandlerSequences::deserialize(archive);
- _inventoryItem = archive.readString();
- _recepient = archive.readString();
+ HandlerSequences::deserialize(archive);
+ _inventoryItem = archive.readString();
+ _recepient = archive.readString();
}
void HandlerUseClick::toConsole() {
- debug("HandlerUseClick: _inventoryItem=%s, _recepient=%s", _inventoryItem.c_str(), _recepient.c_str());
- debug("\tSideEffects:");
- for (uint i = 0; i < _sideEffects.size(); ++i) {
- _sideEffects[i]->toConsole();
- }
-
- debug("\tConditions:");
- for (uint i = 0; i < _conditions.size(); ++i) {
- _conditions[i]->toConsole();
- }
-
- debug("\tSequences:");
- for (uint i = 0; i < _sequences.size(); ++i) {
- debug("\t\t%s", _sequences[i].c_str());
- }
+ debug("HandlerUseClick: _inventoryItem=%s, _recepient=%s", _inventoryItem.c_str(), _recepient.c_str());
+ debug("\tSideEffects:");
+ for (uint i = 0; i < _sideEffects.size(); ++i) {
+ _sideEffects[i]->toConsole();
+ }
+
+ debug("\tConditions:");
+ for (uint i = 0; i < _conditions.size(); ++i) {
+ _conditions[i]->toConsole();
+ }
+
+ debug("\tSequences:");
+ for (uint i = 0; i < _sequences.size(); ++i) {
+ debug("\t\t%s", _sequences[i].c_str());
+ }
}
} // End of namespace Pink
diff --git a/engines/pink/objects/handlers/handler.h b/engines/pink/objects/handlers/handler.h
index 9d0d29833e..98d26620b5 100644
--- a/engines/pink/objects/handlers/handler.h
+++ b/engines/pink/objects/handlers/handler.h
@@ -36,60 +36,60 @@ class Actor;
class Handler : public Object {
public:
- ~Handler();
- virtual void deserialize(Archive &archive);
- virtual void handle(Actor *actor);
- bool isSuitable(Actor *actor);
+ ~Handler();
+ virtual void deserialize(Archive &archive);
+ virtual void handle(Actor *actor);
+ bool isSuitable(Actor *actor);
protected:
- void executeSideEffects(Actor *actor);
+ void executeSideEffects(Actor *actor);
- Array<Condition*> _conditions;
- Array<SideEffect*> _sideEffects;
+ Array<Condition*> _conditions;
+ Array<SideEffect*> _sideEffects;
};
class Sequence;
class HandlerSequences : public Handler {
public:
- virtual void deserialize(Archive &archive);
- virtual void handle(Actor *actor);
+ virtual void deserialize(Archive &archive);
+ virtual void handle(Actor *actor);
protected:
- virtual void execute(Sequence *sequence) = 0;
+ virtual void execute(Sequence *sequence) = 0;
- StringArray _sequences;
+ StringArray _sequences;
};
class HandlerStartPage : public HandlerSequences {
public:
- virtual void toConsole();
+ virtual void toConsole();
private:
- virtual void execute(Sequence *sequence);
+ virtual void execute(Sequence *sequence);
};
class HandlerLeftClick : public HandlerSequences {
public:
- virtual void toConsole();
+ virtual void toConsole();
private:
- virtual void execute(Sequence *sequence) {}
+ virtual void execute(Sequence *sequence) {}
};
class HandlerUseClick : public HandlerSequences {
public:
- virtual void deserialize(Archive &archive);
- virtual void toConsole();
+ virtual void deserialize(Archive &archive);
+ virtual void toConsole();
- const Common::String &getInventoryItem() const { return _inventoryItem; }
- const Common::String &getRecepient() const { return _recepient; }
+ const Common::String &getInventoryItem() const { return _inventoryItem; }
+ const Common::String &getRecepient() const { return _recepient; }
private:
- virtual void execute(Sequence *sequence) {};
+ virtual void execute(Sequence *sequence) {};
- Common::String _inventoryItem;
- Common::String _recepient;
+ Common::String _inventoryItem;
+ Common::String _recepient;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/handlers/handler_mgr.cpp b/engines/pink/objects/handlers/handler_mgr.cpp
index 695030f5d2..cf5b6ca004 100644
--- a/engines/pink/objects/handlers/handler_mgr.cpp
+++ b/engines/pink/objects/handlers/handler_mgr.cpp
@@ -28,107 +28,107 @@
namespace Pink {
void HandlerMgr::deserialize(Archive &archive) {
- _leftClickHandlers.deserialize(archive);
- _useClickHandlers.deserialize(archive);
- _timerHandlers.deserialize(archive);
+ _leftClickHandlers.deserialize(archive);
+ _useClickHandlers.deserialize(archive);
+ _timerHandlers.deserialize(archive);
}
void HandlerMgr::toConsole() {
- debug("HandlerMgr:");
- for (uint i = 0; i < _leftClickHandlers.size(); ++i) {
- _leftClickHandlers[i]->toConsole();
- }
- for (uint i = 0; i < _useClickHandlers.size(); ++i) {
- _useClickHandlers[i]->toConsole();
- }
- for (uint i = 0; i < _timerHandlers.size(); ++i) {
- _timerHandlers[i]->toConsole();
- }
+ debug("HandlerMgr:");
+ for (uint i = 0; i < _leftClickHandlers.size(); ++i) {
+ _leftClickHandlers[i]->toConsole();
+ }
+ for (uint i = 0; i < _useClickHandlers.size(); ++i) {
+ _useClickHandlers[i]->toConsole();
+ }
+ for (uint i = 0; i < _timerHandlers.size(); ++i) {
+ _timerHandlers[i]->toConsole();
+ }
}
bool HandlerMgr::isLeftClickHandler(Actor *actor) {
- for (uint i = 0; i < _leftClickHandlers.size(); ++i) {
- if (_leftClickHandlers[i]->isSuitable(actor))
- return true;
- }
+ for (uint i = 0; i < _leftClickHandlers.size(); ++i) {
+ if (_leftClickHandlers[i]->isSuitable(actor))
+ return true;
+ }
- return false;
+ return false;
}
bool HandlerMgr::isUseClickHandler(Actor *actor, const Common::String &itemName){
- for (uint i = 0; i < _useClickHandlers.size(); ++i) {
- if (itemName == _useClickHandlers[i]->getInventoryItem() &&
- _useClickHandlers[i]->isSuitable(actor))
- return true;
- }
+ for (uint i = 0; i < _useClickHandlers.size(); ++i) {
+ if (itemName == _useClickHandlers[i]->getInventoryItem() &&
+ _useClickHandlers[i]->isSuitable(actor))
+ return true;
+ }
- return false;
+ return false;
}
void HandlerMgr::onTimerMessage(Actor *actor) {
- Handler *handler = findSuitableHandlerTimer(actor);
- if (handler)
- handler->handle(actor);
+ Handler *handler = findSuitableHandlerTimer(actor);
+ if (handler)
+ handler->handle(actor);
}
bool HandlerMgr::onLeftClickMessage(Actor *actor) {
- Handler *handler = findSuitableHandlerLeftClick(actor);
- if (handler) {
- handler->handle(actor);
- return true;
- }
- return false;
+ Handler *handler = findSuitableHandlerLeftClick(actor);
+ if (handler) {
+ handler->handle(actor);
+ return true;
+ }
+ return false;
}
bool HandlerMgr::onUseClickMessage(Actor *actor, InventoryItem *item, InventoryMgr *mgr) {
- HandlerUseClick *handler = findSuitableHandlerUseClick(actor, item);
- if (handler) {
- if (!handler->getRecepient().empty())
- mgr->setItemOwner(handler->getRecepient(), item);
- handler->handle(actor);
- return true;
- }
- return false;
+ HandlerUseClick *handler = findSuitableHandlerUseClick(actor, item);
+ if (handler) {
+ if (!handler->getRecepient().empty())
+ mgr->setItemOwner(handler->getRecepient(), item);
+ handler->handle(actor);
+ return true;
+ }
+ return false;
}
Handler *HandlerMgr::findSuitableHandlerTimer(Actor *actor) {
- for (uint i = 0; i < _timerHandlers.size(); ++i) {
- if (_timerHandlers[i]->isSuitable(actor))
- return _timerHandlers[i];
- }
+ for (uint i = 0; i < _timerHandlers.size(); ++i) {
+ if (_timerHandlers[i]->isSuitable(actor))
+ return _timerHandlers[i];
+ }
- return nullptr;
+ return nullptr;
}
HandlerLeftClick *HandlerMgr::findSuitableHandlerLeftClick(Actor *actor) {
- for (uint i = 0; i < _leftClickHandlers.size(); ++i) {
- if (_leftClickHandlers[i]->isSuitable(actor))
- return _leftClickHandlers[i];
- }
+ for (uint i = 0; i < _leftClickHandlers.size(); ++i) {
+ if (_leftClickHandlers[i]->isSuitable(actor))
+ return _leftClickHandlers[i];
+ }
- return nullptr;
+ return nullptr;
}
HandlerUseClick *HandlerMgr::findSuitableHandlerUseClick(Actor *actor, InventoryItem *item) {
- for (uint i = 0; i < _useClickHandlers.size(); ++i) {
- if (item->getName() == _useClickHandlers[i]->getInventoryItem() && _useClickHandlers[i]->isSuitable(actor))
- return _useClickHandlers[i];
- }
+ for (uint i = 0; i < _useClickHandlers.size(); ++i) {
+ if (item->getName() == _useClickHandlers[i]->getInventoryItem() && _useClickHandlers[i]->isSuitable(actor))
+ return _useClickHandlers[i];
+ }
- return nullptr;
+ return nullptr;
}
HandlerMgr::~HandlerMgr() {
- for (uint i = 0; i < _leftClickHandlers.size(); ++i) {
- delete _leftClickHandlers[i];
- }
- for (uint j = 0; j < _useClickHandlers.size(); ++j) {
- delete _useClickHandlers[j];
- }
- for (uint k = 0; k < _timerHandlers.size(); ++k) {
- delete _timerHandlers[k];
- }
+ for (uint i = 0; i < _leftClickHandlers.size(); ++i) {
+ delete _leftClickHandlers[i];
+ }
+ for (uint j = 0; j < _useClickHandlers.size(); ++j) {
+ delete _useClickHandlers[j];
+ }
+ for (uint k = 0; k < _timerHandlers.size(); ++k) {
+ delete _timerHandlers[k];
+ }
}
} // End of namespace Pink
diff --git a/engines/pink/objects/handlers/handler_mgr.h b/engines/pink/objects/handlers/handler_mgr.h
index 36e2b05513..dabb329d27 100644
--- a/engines/pink/objects/handlers/handler_mgr.h
+++ b/engines/pink/objects/handlers/handler_mgr.h
@@ -39,26 +39,26 @@ class Actor;
class HandlerMgr : public Object {
public:
- virtual ~HandlerMgr();
- virtual void deserialize(Archive &archive);
+ virtual ~HandlerMgr();
+ virtual void deserialize(Archive &archive);
- virtual void toConsole();
+ virtual void toConsole();
- bool isLeftClickHandler(Actor *actor);
- bool isUseClickHandler(Actor *actor, const Common::String &itemName);
+ bool isLeftClickHandler(Actor *actor);
+ bool isUseClickHandler(Actor *actor, const Common::String &itemName);
- void onTimerMessage(Actor *actor);
- bool onLeftClickMessage(Actor *actor);
- bool onUseClickMessage(Actor *actor, InventoryItem *item, InventoryMgr *mgr);
+ void onTimerMessage(Actor *actor);
+ bool onLeftClickMessage(Actor *actor);
+ bool onUseClickMessage(Actor *actor, InventoryItem *item, InventoryMgr *mgr);
private:
- Handler *findSuitableHandlerTimer(Actor *actor);
- HandlerLeftClick *findSuitableHandlerLeftClick(Actor *actor);
- HandlerUseClick *findSuitableHandlerUseClick(Actor *actor, InventoryItem *item);
+ Handler *findSuitableHandlerTimer(Actor *actor);
+ HandlerLeftClick *findSuitableHandlerLeftClick(Actor *actor);
+ HandlerUseClick *findSuitableHandlerUseClick(Actor *actor, InventoryItem *item);
- Array<HandlerLeftClick*> _leftClickHandlers;
- Array<HandlerUseClick*> _useClickHandlers;
- Array<Handler*> _timerHandlers;
+ Array<HandlerLeftClick*> _leftClickHandlers;
+ Array<HandlerUseClick*> _useClickHandlers;
+ Array<Handler*> _timerHandlers;
};
}
diff --git a/engines/pink/objects/handlers/handler_timer.cpp b/engines/pink/objects/handlers/handler_timer.cpp
index d9f75f67b9..e27d4bb207 100644
--- a/engines/pink/objects/handlers/handler_timer.cpp
+++ b/engines/pink/objects/handlers/handler_timer.cpp
@@ -36,76 +36,76 @@ namespace Pink {
void HandlerTimerActions::deserialize(Archive &archive) {
- Handler::deserialize(archive);
- _actions.deserialize(archive);
+ Handler::deserialize(archive);
+ _actions.deserialize(archive);
}
void HandlerTimerActions::toConsole() {
- debug("HandlerTimerActions:");
-
- debug("\tSideEffects:");
- for (uint i = 0; i < _sideEffects.size(); ++i) {
- _sideEffects[i]->toConsole();
- }
-
- debug("\tConditions:");
- for (uint i = 0; i < _conditions.size(); ++i) {
- _conditions[i]->toConsole();
- }
-
- debug("\tActions:");
- for (uint i = 0; i < _actions.size(); ++i) {
- debug("\t\t%s", _actions[i].c_str());
- }
+ debug("HandlerTimerActions:");
+
+ debug("\tSideEffects:");
+ for (uint i = 0; i < _sideEffects.size(); ++i) {
+ _sideEffects[i]->toConsole();
+ }
+
+ debug("\tConditions:");
+ for (uint i = 0; i < _conditions.size(); ++i) {
+ _conditions[i]->toConsole();
+ }
+
+ debug("\tActions:");
+ for (uint i = 0; i < _actions.size(); ++i) {
+ debug("\t\t%s", _actions[i].c_str());
+ }
}
void HandlerTimerActions::handle(Actor *actor) {
- Handler::handle(actor);
- if (!actor->isPlaying() && !_actions.empty()) {
- Common::RandomSource &rnd = actor->getPage()->getGame()->getRnd();
- uint index = rnd.getRandomNumber(_actions.size() - 1);
- Action *action = actor->findAction(_actions[index]);
- assert(action);
- actor->setAction(action, 0);
- }
+ Handler::handle(actor);
+ if (!actor->isPlaying() && !_actions.empty()) {
+ Common::RandomSource &rnd = actor->getPage()->getGame()->getRnd();
+ uint index = rnd.getRandomNumber(_actions.size() - 1);
+ Action *action = actor->findAction(_actions[index]);
+ assert(action);
+ actor->setAction(action, 0);
+ }
}
void HandlerTimerSequences::execute(Sequence *sequence) {
- error("HandlerTimerSequences function is not implemented");
+ error("HandlerTimerSequences function is not implemented");
}
void HandlerTimerSequences::toConsole() {
- debug("HandlerTimerSequences:");
-
- debug("\tSideEffects:");
- for (uint i = 0; i < _sideEffects.size(); ++i) {
- _sideEffects[i]->toConsole();
- }
-
- debug("\tConditions:");
- for (uint i = 0; i < _conditions.size(); ++i) {
- _conditions[i]->toConsole();
- }
-
- debug("\tSequences:");
- for (uint i = 0; i < _sequences.size(); ++i) {
- debug("\t\t%s", _sequences[i].c_str());
- }
+ debug("HandlerTimerSequences:");
+
+ debug("\tSideEffects:");
+ for (uint i = 0; i < _sideEffects.size(); ++i) {
+ _sideEffects[i]->toConsole();
+ }
+
+ debug("\tConditions:");
+ for (uint i = 0; i < _conditions.size(); ++i) {
+ _conditions[i]->toConsole();
+ }
+
+ debug("\tSequences:");
+ for (uint i = 0; i < _sequences.size(); ++i) {
+ debug("\t\t%s", _sequences[i].c_str());
+ }
}
void HandlerTimerSequences::handle(Actor *actor) {
- Handler::handle(actor);
- Sequencer *sequencer = actor->getSequencer();
+ Handler::handle(actor);
+ Sequencer *sequencer = actor->getSequencer();
- assert(!_sequences.empty());
+ assert(!_sequences.empty());
- Common::RandomSource &rnd = actor->getPage()->getGame()->getRnd();
- uint index = rnd.getRandomNumber(_sequences.size() - 1);
+ Common::RandomSource &rnd = actor->getPage()->getGame()->getRnd();
+ uint index = rnd.getRandomNumber(_sequences.size() - 1);
- Sequence *sequence = sequencer->findSequence(_sequences[index]);
+ Sequence *sequence = sequencer->findSequence(_sequences[index]);
- assert(sequence);
+ assert(sequence);
}
} // End of namespace Pink
diff --git a/engines/pink/objects/handlers/handler_timer.h b/engines/pink/objects/handlers/handler_timer.h
index cbe6824d2a..b420272c2a 100644
--- a/engines/pink/objects/handlers/handler_timer.h
+++ b/engines/pink/objects/handlers/handler_timer.h
@@ -39,23 +39,23 @@ class HandlerTimer : public Handler {
//in Peril this is HandlerTimer
class HandlerTimerActions : public Handler {
public:
- virtual void toConsole();
- virtual void deserialize(Archive &archive);
- virtual void handle(Actor *actor);
+ virtual void toConsole();
+ virtual void deserialize(Archive &archive);
+ virtual void handle(Actor *actor);
private:
- StringArray _actions;
+ StringArray _actions;
};
//appear in HokusPokus
class HandlerTimerSequences : public HandlerSequences { //originally it was inherited from HandlerTimer
public:
- virtual void toConsole();
+ virtual void toConsole();
- virtual void handle(Actor *actor);
+ virtual void handle(Actor *actor);
protected:
- virtual void execute(Sequence *sequence);
+ virtual void execute(Sequence *sequence);
};
} // End of namespace Pink
diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/objects/inventory.cpp
index a7a483f24d..c2ad3bb0a7 100644
--- a/engines/pink/objects/inventory.cpp
+++ b/engines/pink/objects/inventory.cpp
@@ -33,32 +33,32 @@
namespace Pink {
InventoryMgr::InventoryMgr()
- : _lead(nullptr), _item(nullptr), _isClickedOnItem(false)
+ : _lead(nullptr), _item(nullptr), _isClickedOnItem(false)
{
}
void Pink::InventoryItem::deserialize(Archive &archive) {
- NamedObject::deserialize(archive);
- _initialOwner = archive.readString();
- _currentOwner = _initialOwner;
+ NamedObject::deserialize(archive);
+ _initialOwner = archive.readString();
+ _currentOwner = _initialOwner;
}
Common::String &InventoryItem::getCurrentOwner() {
- return _currentOwner;
+ return _currentOwner;
}
void InventoryItem::toConsole() {
- debug("\tInventoryItem: _initialOwner=%s _currentOwner=%s", _initialOwner.c_str(), _currentOwner.c_str());
+ debug("\tInventoryItem: _initialOwner=%s _currentOwner=%s", _initialOwner.c_str(), _currentOwner.c_str());
}
InventoryMgr::~InventoryMgr() {
- for (uint i = 0; i < _items.size(); ++i) {
- delete _items[i];
- }
+ for (uint i = 0; i < _items.size(); ++i) {
+ delete _items[i];
+ }
}
void InventoryMgr::deserialize(Archive &archive) {
- _items.deserialize(archive);
+ _items.deserialize(archive);
}
InventoryItem *InventoryMgr::findInventoryItem(const Common::String &name) {
@@ -71,133 +71,133 @@ InventoryItem *InventoryMgr::findInventoryItem(const Common::String &name) {
}
void InventoryMgr::setLeadActor(LeadActor *lead) {
- _lead = lead;
+ _lead = lead;
}
void InventoryMgr::toConsole() {
- debug("InventoryMgr:");
- for (uint i = 0; i < _items.size(); ++i) {
- _items[i]->toConsole();
- }
+ debug("InventoryMgr:");
+ for (uint i = 0; i < _items.size(); ++i) {
+ _items[i]->toConsole();
+ }
}
bool InventoryMgr::isPinkOwnsAnyItems() {
- if (_item)
- return true;
+ if (_item)
+ return true;
- for (uint i = 0; i < _items.size(); ++i) {
- if (_items[i]->getCurrentOwner() == _lead->getName()){
- _item = _items[i];
- return true;
- }
- }
+ for (uint i = 0; i < _items.size(); ++i) {
+ if (_items[i]->getCurrentOwner() == _lead->getName()){
+ _item = _items[i];
+ return true;
+ }
+ }
- return false;
+ return false;
}
void InventoryMgr::setItemOwner(const Common::String &owner, InventoryItem *item) {
- if (owner == item->getCurrentOwner())
- return;
+ if (owner == item->getCurrentOwner())
+ return;
- if (item == _item && _lead->getName() != owner)
- _item = nullptr;
+ if (item == _item && _lead->getName() != owner)
+ _item = nullptr;
- item->_currentOwner = owner;
+ item->_currentOwner = owner;
- if (_lead->getName() == owner)
- _item = item;
+ if (_lead->getName() == owner)
+ _item = item;
}
bool InventoryMgr::start(bool playOpening) {
- if (!_item) {
- _item = findInventoryItem(_lead->getName());
- if (!_item)
- return false;
- }
+ if (!_item) {
+ _item = findInventoryItem(_lead->getName());
+ if (!_item)
+ return false;
+ }
- _window = _lead->getPage()->findActor(kInventoryWindowActor);
- _itemActor = _lead->getPage()->findActor(kInventoryItemActor);
- _rightArrow = _lead->getPage()->findActor(kInventoryRightArrowActor);
- _leftArrow = _lead->getPage()->findActor(kInventoryLeftArrowActor);
+ _window = _lead->getPage()->findActor(kInventoryWindowActor);
+ _itemActor = _lead->getPage()->findActor(kInventoryItemActor);
+ _rightArrow = _lead->getPage()->findActor(kInventoryRightArrowActor);
+ _leftArrow = _lead->getPage()->findActor(kInventoryLeftArrowActor);
- if (playOpening){
- _window->setAction(kOpenAction);
- _state = kOpening;
- }
+ if (playOpening){
+ _window->setAction(kOpenAction);
+ _state = kOpening;
+ }
- return true;
+ return true;
}
void InventoryMgr::update() {
- if (_state == kOpening && !_window->isPlaying()){
- _state = kReady;
- _itemActor->setAction(_item->getName());
- _window->setAction(kShowAction);
- _leftArrow->setAction(kShowAction);
- _rightArrow->setAction(kShowAction);
- }
- else if (_state == kClosing && !_window->isPlaying()){
- _window->setAction(kIdleAction);
+ if (_state == kOpening && !_window->isPlaying()){
+ _state = kReady;
+ _itemActor->setAction(_item->getName());
+ _window->setAction(kShowAction);
+ _leftArrow->setAction(kShowAction);
+ _rightArrow->setAction(kShowAction);
+ }
+ else if (_state == kClosing && !_window->isPlaying()){
+ _window->setAction(kIdleAction);
- _lead->onInventoryClosed(_isClickedOnItem);
+ _lead->onInventoryClosed(_isClickedOnItem);
- _state = kIdle;
+ _state = kIdle;
- _window = nullptr;
- _itemActor = nullptr;
- _isClickedOnItem = false;
- }
+ _window = nullptr;
+ _itemActor = nullptr;
+ _isClickedOnItem = false;
+ }
}
void InventoryMgr::onClick(Common::Point point) {
- if (_state != kReady)
- return;
-
- Actor *actor = _lead->getPage()->getGame()->getDirector()->getActorByPoint(point);
- if (actor == _itemActor || actor == _window) {
- _isClickedOnItem = true;
- close();
- }
- else if (actor == _leftArrow) {
- showNextItem(kLeft);
- }
- else if (actor == _rightArrow) {
- showNextItem(kRight);
- }
- else close();
+ if (_state != kReady)
+ return;
+
+ Actor *actor = _lead->getPage()->getGame()->getDirector()->getActorByPoint(point);
+ if (actor == _itemActor || actor == _window) {
+ _isClickedOnItem = true;
+ close();
+ }
+ else if (actor == _leftArrow) {
+ showNextItem(kLeft);
+ }
+ else if (actor == _rightArrow) {
+ showNextItem(kRight);
+ }
+ else close();
}
void InventoryMgr::close() {
- _state = kClosing;
+ _state = kClosing;
- _window->setAction(kCloseAction);
- _itemActor->setAction(kIdleAction);
- _leftArrow->setAction(kIdleAction);
- _rightArrow->setAction(kIdleAction);
+ _window->setAction(kCloseAction);
+ _itemActor->setAction(kIdleAction);
+ _leftArrow->setAction(kIdleAction);
+ _rightArrow->setAction(kIdleAction);
}
void InventoryMgr::showNextItem(bool direction) {
- int index = 0;
- for (uint i = 0; i < _items.size(); ++i) {
- if (_item == _items[i]) {
- index = i + _items.size();
- break;
- }
- }
+ int index = 0;
+ for (uint i = 0; i < _items.size(); ++i) {
+ if (_item == _items[i]) {
+ index = i + _items.size();
+ break;
+ }
+ }
- uint i = 0;
- do {
- index = (direction == kLeft) ? --index : ++index;
- } while(_items[index % _items.size()]->getCurrentOwner() != _item->getCurrentOwner() && ++i < _items.size());
+ uint i = 0;
+ do {
+ index = (direction == kLeft) ? --index : ++index;
+ } while(_items[index % _items.size()]->getCurrentOwner() != _item->getCurrentOwner() && ++i < _items.size());
- if (i != _items.size()) {
- _item = _items[index % _items.size()];
- _itemActor->setAction(_item->getName());
- }
+ if (i != _items.size()) {
+ _item = _items[index % _items.size()];
+ _itemActor->setAction(_item->getName());
+ }
}
InventoryItem *InventoryMgr::getCurrentItem() {
- return _item;
+ return _item;
}
} // End of namespace Pink
diff --git a/engines/pink/objects/inventory.h b/engines/pink/objects/inventory.h
index b8de36b8b4..02bf9d6182 100644
--- a/engines/pink/objects/inventory.h
+++ b/engines/pink/objects/inventory.h
@@ -31,16 +31,16 @@ namespace Pink {
class InventoryItem : public NamedObject {
public:
- virtual void deserialize(Archive &archive);
+ virtual void deserialize(Archive &archive);
- virtual void toConsole();
+ virtual void toConsole();
- Common::String &getCurrentOwner();
+ Common::String &getCurrentOwner();
- friend class InventoryMgr;
+ friend class InventoryMgr;
private:
- Common::String _initialOwner;
- Common::String _currentOwner;
+ Common::String _initialOwner;
+ Common::String _currentOwner;
};
class LeadActor;
@@ -48,51 +48,51 @@ class Actor;
class InventoryMgr : public Object {
public:
- InventoryMgr();
- virtual ~InventoryMgr();
- virtual void deserialize(Archive &archive);
- virtual void toConsole();
+ InventoryMgr();
+ virtual ~InventoryMgr();
+ virtual void deserialize(Archive &archive);
+ virtual void toConsole();
- void update();
- void onClick(Common::Point point);
+ void update();
+ void onClick(Common::Point point);
- bool start(bool playOpening);
+ bool start(bool playOpening);
- void setLeadActor(LeadActor *lead);
- InventoryItem* findInventoryItem(const Common::String &name);
+ void setLeadActor(LeadActor *lead);
+ InventoryItem* findInventoryItem(const Common::String &name);
- bool isPinkOwnsAnyItems();
- void setItemOwner(const Common::String &owner, InventoryItem *item);
+ bool isPinkOwnsAnyItems();
+ void setItemOwner(const Common::String &owner, InventoryItem *item);
- InventoryItem *getCurrentItem();
+ InventoryItem *getCurrentItem();
private:
- void close();
- enum Direction {
- kLeft = 0,
- kRight = 1,
- };
- void showNextItem(bool direction);
+ void close();
+ enum Direction {
+ kLeft = 0,
+ kRight = 1,
+ };
+ void showNextItem(bool direction);
- LeadActor *_lead;
- Actor *_window;
- Actor *_itemActor;
- Actor *_rightArrow;
- Actor *_leftArrow;
+ LeadActor *_lead;
+ Actor *_window;
+ Actor *_itemActor;
+ Actor *_rightArrow;
+ Actor *_leftArrow;
- InventoryItem *_item;
- Array<InventoryItem*> _items;
+ InventoryItem *_item;
+ Array<InventoryItem*> _items;
- enum State {
- kIdle = 0,
- kOpening = 1,
- kReady = 2,
- kClosing = 3,
- } _state;
- bool _isClickedOnItem;
+ enum State {
+ kIdle = 0,
+ kOpening = 1,
+ kReady = 2,
+ kClosing = 3,
+ } _state;
+ bool _isClickedOnItem;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/module.cpp b/engines/pink/objects/module.cpp
index 019f71ba30..5a7dd6bbc9 100644
--- a/engines/pink/objects/module.cpp
+++ b/engines/pink/objects/module.cpp
@@ -27,52 +27,52 @@
namespace Pink {
ModuleProxy::ModuleProxy(const Common::String &name)
- : NamedObject(name)
+ : NamedObject(name)
{}
ModuleProxy::ModuleProxy() {}
Module::Module(PinkEngine *game, const Common::String &name)
- : NamedObject(name), _game(game), _page(nullptr)
+ : NamedObject(name), _game(game), _page(nullptr)
{}
Module::~Module() {
- for (uint i = 0; i < _pages.size(); ++i) {
- delete _pages[i];
- }
+ for (uint i = 0; i < _pages.size(); ++i) {
+ delete _pages[i];
+ }
}
void Module::load(Archive &archive){
- archive.mapObject(this);
- NamedObject::deserialize(archive);
+ archive.mapObject(this);
+ NamedObject::deserialize(archive);
- archive.readString(); // skip directory
+ archive.readString(); // skip directory
- _invMgr.deserialize(archive);
- _pages.deserialize(archive);
+ _invMgr.deserialize(archive);
+ _pages.deserialize(archive);
}
void Module::init(bool isLoadingSave, const Common::String &pageName) {
- // 0 0 - new game
- // 0 1 - module changed
- // 1 0 - from save
- if (!pageName.empty())
- _page = findPage(pageName);
- else if (!_page)
- _page = _pages[0];
-
- _page->init(isLoadingSave);
+ // 0 0 - new game
+ // 0 1 - module changed
+ // 1 0 - from save
+ if (!pageName.empty())
+ _page = findPage(pageName);
+ else if (!_page)
+ _page = _pages[0];
+
+ _page->init(isLoadingSave);
}
void Module::changePage(const Common::String &pageName) {
- GamePage *page = nullptr;
- page = findPage(pageName);
- assert(_page != page);
+ GamePage *page = nullptr;
+ page = findPage(pageName);
+ assert(_page != page);
- _page->unload();
+ _page->unload();
- _page = page;
- _page->init(kLoadingNewGame);
+ _page = page;
+ _page->init(kLoadingNewGame);
}
GamePage *Module::findPage(const Common::String &pageName) const {
@@ -84,21 +84,21 @@ GamePage *Module::findPage(const Common::String &pageName) const {
}
PinkEngine *Module::getGame() const {
- return _game;
+ return _game;
}
bool Module::checkValueOfVariable(Common::String &variable, Common::String &value) {
- if (!_variables.contains(variable))
- return value == kUndefined;
- return _variables[variable] == value;
+ if (!_variables.contains(variable))
+ return value == kUndefined;
+ return _variables[variable] == value;
}
void Module::setVariable(Common::String &variable, Common::String &value) {
- _variables[variable] = value;
+ _variables[variable] = value;
}
InventoryMgr *Module::getInventoryMgr() {
- return &_invMgr;
+ return &_invMgr;
}
} // End of namespace Pink
diff --git a/engines/pink/objects/module.h b/engines/pink/objects/module.h
index 622381d8a3..5c253ebcbe 100644
--- a/engines/pink/objects/module.h
+++ b/engines/pink/objects/module.h
@@ -34,8 +34,8 @@ namespace Pink {
class ModuleProxy : public NamedObject {
public:
- ModuleProxy();
- ModuleProxy(const Common::String &name);
+ ModuleProxy();
+ ModuleProxy(const Common::String &name);
};
class PinkEngine;
@@ -43,31 +43,31 @@ class GamePage;
class Module : public NamedObject {
public:
- Module(PinkEngine *game, const Common::String &name);
- ~Module();
+ Module(PinkEngine *game, const Common::String &name);
+ ~Module();
- void load(Archive &archive);
- void init(bool isLoadingSave, const Common::String &pageName);
- void changePage(const Common::String &pageName);
+ void load(Archive &archive);
+ void init(bool isLoadingSave, const Common::String &pageName);
+ void changePage(const Common::String &pageName);
- void OnLeftButtonDown();
- void OnMouseMove();
- void OnKeyboardButtonClick();
+ void OnLeftButtonDown();
+ void OnMouseMove();
+ void OnKeyboardButtonClick();
- PinkEngine *getGame() const;
- InventoryMgr *getInventoryMgr();
+ PinkEngine *getGame() const;
+ InventoryMgr *getInventoryMgr();
- bool checkValueOfVariable(Common::String &variable, Common::String &value);
- void setVariable(Common::String &variable, Common::String &value);
+ bool checkValueOfVariable(Common::String &variable, Common::String &value);
+ void setVariable(Common::String &variable, Common::String &value);
private:
- GamePage *findPage(const Common::String &pageName) const;
+ GamePage *findPage(const Common::String &pageName) const;
- PinkEngine *_game;
- GamePage *_page;
- Array<GamePage*> _pages;
- InventoryMgr _invMgr;
- Common::StringMap _variables;
+ PinkEngine *_game;
+ GamePage *_page;
+ Array<GamePage*> _pages;
+ InventoryMgr _invMgr;
+ Common::StringMap _variables;
};
diff --git a/engines/pink/objects/object.cpp b/engines/pink/objects/object.cpp
index 6e5005372e..4d9041f891 100644
--- a/engines/pink/objects/object.cpp
+++ b/engines/pink/objects/object.cpp
@@ -27,15 +27,15 @@
namespace Pink {
Pink::NamedObject::NamedObject(const Common::String &name)
- : _name(name)
+ : _name(name)
{}
void Pink::NamedObject::deserialize(Archive &archive) {
- _name = archive.readString();
+ _name = archive.readString();
}
const Common::String &Pink::NamedObject::getName() const {
- return _name;
+ return _name;
}
void NamedObject::store(Archive &archive) {
diff --git a/engines/pink/objects/object.h b/engines/pink/objects/object.h
index 88ce35b3b7..62ca9f758a 100644
--- a/engines/pink/objects/object.h
+++ b/engines/pink/objects/object.h
@@ -31,26 +31,26 @@ class Archive;
class Object {
public:
- virtual ~Object() {};
- virtual void load(Archive &){};
- virtual void store(Archive &){};
- virtual void deserialize(Archive &){};
- virtual void init() {}
- virtual void toConsole() {};
+ virtual ~Object() {};
+ virtual void load(Archive &){};
+ virtual void store(Archive &){};
+ virtual void deserialize(Archive &){};
+ virtual void init() {}
+ virtual void toConsole() {};
};
class NamedObject : public Object {
public:
- NamedObject(){};
- NamedObject(const Common::String &name);
+ NamedObject(){};
+ NamedObject(const Common::String &name);
- void deserialize(Archive &archive);
- void store(Archive &archive);
+ void deserialize(Archive &archive);
+ void store(Archive &archive);
- const Common::String &getName() const;
+ const Common::String &getName() const;
protected:
- Common::String _name;
+ Common::String _name;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp
index 952ea42b1f..83df359b80 100644
--- a/engines/pink/objects/pages/game_page.cpp
+++ b/engines/pink/objects/pages/game_page.cpp
@@ -31,128 +31,128 @@
namespace Pink {
GamePage::GamePage()
- : _cursorMgr(nullptr), _walkMgr(nullptr), _sequencer(nullptr),
- _isLoaded(false), _memFile(nullptr)
+ : _cursorMgr(nullptr), _walkMgr(nullptr), _sequencer(nullptr),
+ _isLoaded(false), _memFile(nullptr)
{}
GamePage::~GamePage() {
- clear();
+ clear();
}
void GamePage::toConsole() {
- Page::toConsole();
- _walkMgr->toConsole();
- _sequencer->toConsole();
- for (uint i = 0; i < _handlers.size(); ++i) {
- _handlers[i]->toConsole();
- }
+ Page::toConsole();
+ _walkMgr->toConsole();
+ _sequencer->toConsole();
+ for (uint i = 0; i < _handlers.size(); ++i) {
+ _handlers[i]->toConsole();
+ }
}
void GamePage::deserialize(Archive &archive) {
- Page::deserialize(archive);
- _module = static_cast<Module*>(archive.readObject());
- assert(dynamic_cast<Module*>(_module) != 0);
+ Page::deserialize(archive);
+ _module = static_cast<Module*>(archive.readObject());
+ assert(dynamic_cast<Module*>(_module) != 0);
}
void GamePage::load(Archive &archive) {
- archive.mapObject(_cursorMgr);
- archive.mapObject(_walkMgr);
- archive.mapObject(_sequencer);
+ archive.mapObject(_cursorMgr);
+ archive.mapObject(_walkMgr);
+ archive.mapObject(_sequencer);
- Page::load(archive);
+ Page::load(archive);
- _leadActor = static_cast<LeadActor*>(archive.readObject());
+ _leadActor = static_cast<LeadActor*>(archive.readObject());
- _walkMgr->deserialize(archive);
- _sequencer->deserialize(archive);
- _handlers.deserialize(archive);
+ _walkMgr->deserialize(archive);
+ _sequencer->deserialize(archive);
+ _handlers.deserialize(archive);
}
void GamePage::init(bool isLoadingSave) {
- if (!_isLoaded)
- loadManagers();
+ if (!_isLoaded)
+ loadManagers();
- toConsole();
+ toConsole();
- for (uint j = 0; j < _actors.size(); ++j) {
- if (_actors[j]->initPallete(_module->getGame()->getDirector()))
- break;
- }
+ for (uint j = 0; j < _actors.size(); ++j) {
+ if (_actors[j]->initPallete(_module->getGame()->getDirector()))
+ break;
+ }
- LeadActor::State state = _leadActor->getState();
- bool startNow = !(state == LeadActor::kInventory || state == LeadActor::kPDA);
+ LeadActor::State state = _leadActor->getState();
+ bool startNow = !(state == LeadActor::kInventory || state == LeadActor::kPDA);
- for (uint i = 0; i < _actors.size(); ++i) {
- _actors[i]->init(startNow);
- }
+ for (uint i = 0; i < _actors.size(); ++i) {
+ _actors[i]->init(startNow);
+ }
- bool isHandler = false;
- if (!isLoadingSave) {
- isHandler = initHandler();
- }
+ bool isHandler = false;
+ if (!isLoadingSave) {
+ isHandler = initHandler();
+ }
- _leadActor->start(isHandler);
+ _leadActor->start(isHandler);
}
bool GamePage::initHandler() {
- for (uint i = 0; i < _handlers.size(); ++i) {
- if (_handlers[i]->isSuitable(_leadActor)){
- _handlers[i]->handle(_leadActor);
- return true;
- }
- }
- return false;
+ for (uint i = 0; i < _handlers.size(); ++i) {
+ if (_handlers[i]->isSuitable(_leadActor)){
+ _handlers[i]->handle(_leadActor);
+ return true;
+ }
+ }
+ return false;
}
void GamePage::loadManagers() {
- _isLoaded = true;
+ _isLoaded = true;
- _cursorMgr = new CursorMgr(_module->getGame(), this);
- _walkMgr = new WalkMgr;
- _sequencer = new Sequencer(this);
+ _cursorMgr = new CursorMgr(_module->getGame(), this);
+ _walkMgr = new WalkMgr;
+ _sequencer = new Sequencer(this);
- _resMgr.init(_module->getGame(), this);
+ _resMgr.init(_module->getGame(), this);
- if (_memFile != nullptr) {
- loadState();
+ if (_memFile != nullptr) {
+ loadState();
- delete _memFile;
- _memFile = nullptr;
- }
+ delete _memFile;
+ _memFile = nullptr;
+ }
}
PinkEngine *GamePage::getGame() {
- return _resMgr.getGame();
+ return _resMgr.getGame();
}
Sequencer *GamePage::getSequencer() {
- return _sequencer;
+ return _sequencer;
}
Module *GamePage::getModule() const {
- return _module;
+ return _module;
}
bool GamePage::checkValueOfVariable(const Common::String &variable, const Common::String &value) {
- if (!_variables.contains(variable))
- return value == kUndefined;
- return _variables[variable] == value;
+ if (!_variables.contains(variable))
+ return value == kUndefined;
+ return _variables[variable] == value;
}
void GamePage::setVariable(Common::String &variable, Common::String &value) {
- _variables[variable] = value;
- _leadActor->onVariableSet();
+ _variables[variable] = value;
+ _leadActor->onVariableSet();
}
WalkMgr *GamePage::getWalkMgr() {
- return _walkMgr;
+ return _walkMgr;
}
void GamePage::loadState() {
- Archive archive(static_cast<Common::SeekableReadStream*>(_memFile));
- //_variables.clear(1);
- Common::StringMap mapTest; // HACK. Without it isn't working
- //archive >> _variables;
+ Archive archive(static_cast<Common::SeekableReadStream*>(_memFile));
+ //_variables.clear(1);
+ Common::StringMap mapTest; // HACK. Without it isn't working
+ //archive >> _variables;
uint size = archive.readCount();
for (uint i = 0; i < size; ++i) {
@@ -161,56 +161,56 @@ void GamePage::loadState() {
mapTest.setVal(key, val);
}
- _variables = mapTest;
+ _variables = mapTest;
- uint16 actorCount = archive.readWORD();
+ uint16 actorCount = archive.readWORD();
- Common::String actorName;
- for (int i = 0; i < actorCount; ++i) {
- actorName = archive.readString();
- findActor(actorName)->loadState(archive);
- }
+ Common::String actorName;
+ for (int i = 0; i < actorCount; ++i) {
+ actorName = archive.readString();
+ findActor(actorName)->loadState(archive);
+ }
}
void GamePage::saveState() {
- _memFile = new Common::MemoryReadWriteStream(DisposeAfterUse::YES);
- Archive archive(static_cast<Common::WriteStream*>(_memFile));
+ _memFile = new Common::MemoryReadWriteStream(DisposeAfterUse::YES);
+ Archive archive(static_cast<Common::WriteStream*>(_memFile));
- for (Common::StringMap::const_iterator it = _variables.begin(); it != _variables.end(); ++it) {
- archive.writeString(it->_key);
- archive.writeString(it->_value);
- }
+ for (Common::StringMap::const_iterator it = _variables.begin(); it != _variables.end(); ++it) {
+ archive.writeString(it->_key);
+ archive.writeString(it->_value);
+ }
- archive.writeWORD(_actors.size());
- for (uint i = 0; i < _actors.size(); ++i) {
- archive.writeString(_actors[i]->getName());
- _actors[i]->saveState(archive);
- }
+ archive.writeWORD(_actors.size());
+ for (uint i = 0; i < _actors.size(); ++i) {
+ archive.writeString(_actors[i]->getName());
+ _actors[i]->saveState(archive);
+ }
}
void GamePage::unload() {
- _leadActor->setAction(_leadActor->findAction(kIdleAction));
+ _leadActor->setAction(_leadActor->findAction(kIdleAction));
- saveState();
- clear();
+ saveState();
+ clear();
- _isLoaded = false;
+ _isLoaded = false;
}
void GamePage::clear() {
- Page::clear();
- //_variables.clear(1);
+ Page::clear();
+ //_variables.clear(1);
- for (uint i = 0; i < _handlers.size(); ++i) {
- delete _handlers[i];
- }
+ for (uint i = 0; i < _handlers.size(); ++i) {
+ delete _handlers[i];
+ }
- _handlers.clear();
+ _handlers.clear();
- delete _cursorMgr; _cursorMgr = nullptr;
- delete _sequencer; _sequencer = nullptr;
- delete _walkMgr; _walkMgr = nullptr;
+ delete _cursorMgr; _cursorMgr = nullptr;
+ delete _sequencer; _sequencer = nullptr;
+ delete _walkMgr; _walkMgr = nullptr;
}
} // End of namespace Pink
diff --git a/engines/pink/objects/pages/game_page.h b/engines/pink/objects/pages/game_page.h
index 5aad7ac66f..1bae58d768 100644
--- a/engines/pink/objects/pages/game_page.h
+++ b/engines/pink/objects/pages/game_page.h
@@ -36,39 +36,39 @@ class HandlerStartPage;
class GamePage : public Page {
public:
- GamePage();
- ~GamePage();
- virtual void toConsole();
- virtual void deserialize(Archive &archive);
+ GamePage();
+ ~GamePage();
+ virtual void toConsole();
+ virtual void deserialize(Archive &archive);
- virtual void load(Archive &archive);
- void unload();
- void loadManagers();
- void init(bool isLoadingSave);
+ virtual void load(Archive &archive);
+ void unload();
+ void loadManagers();
+ void init(bool isLoadingSave);
- PinkEngine *getGame();
- Sequencer *getSequencer();
- WalkMgr *getWalkMgr();
- Module *getModule() const;
+ PinkEngine *getGame();
+ Sequencer *getSequencer();
+ WalkMgr *getWalkMgr();
+ Module *getModule() const;
- bool checkValueOfVariable(const Common::String &variable, const Common::String &value);
- void setVariable(Common::String &variable, Common::String &value);
+ bool checkValueOfVariable(const Common::String &variable, const Common::String &value);
+ void setVariable(Common::String &variable, Common::String &value);
- virtual void clear();
+ virtual void clear();
private:
- bool initHandler();
- void loadState();
- void saveState();
+ bool initHandler();
+ void loadState();
+ void saveState();
- bool _isLoaded;
- Common::MemoryReadWriteStream *_memFile;
- Module *_module;
- CursorMgr *_cursorMgr;
- WalkMgr *_walkMgr;
- Sequencer *_sequencer;
- Array<HandlerStartPage*> _handlers;
- Common::StringMap _variables;
+ bool _isLoaded;
+ Common::MemoryReadWriteStream *_memFile;
+ Module *_module;
+ CursorMgr *_cursorMgr;
+ WalkMgr *_walkMgr;
+ Sequencer *_sequencer;
+ Array<HandlerStartPage*> _handlers;
+ Common::StringMap _variables;
};
}
diff --git a/engines/pink/objects/pages/page.cpp b/engines/pink/objects/pages/page.cpp
index 4b2f5f1d49..1465e17b39 100644
--- a/engines/pink/objects/pages/page.cpp
+++ b/engines/pink/objects/pages/page.cpp
@@ -27,14 +27,14 @@
namespace Pink {
Page::~Page() {
- clear();
+ clear();
}
void Page::load(Archive &archive) {
- archive.mapObject(this);
- NamedObject::deserialize(archive);
- archive.readString(); //skip directory
- _actors.deserialize(archive);
+ archive.mapObject(this);
+ NamedObject::deserialize(archive);
+ archive.readString(); //skip directory
+ _actors.deserialize(archive);
}
Actor *Page::findActor(const Common::String &name) {
@@ -47,52 +47,52 @@ Actor *Page::findActor(const Common::String &name) {
}
Sound *Page::loadSound(Common::String &fileName) {
- return _resMgr.loadSound(fileName);
+ return _resMgr.loadSound(fileName);
}
CelDecoder *Page::loadCel(Common::String &fileName) {
- return _resMgr.loadCEL(fileName);
+ return _resMgr.loadCEL(fileName);
}
void Page::toConsole() {
- for (uint i = 0; i < _actors.size(); ++i) {
- _actors[i]->toConsole();
- }
+ for (uint i = 0; i < _actors.size(); ++i) {
+ _actors[i]->toConsole();
+ }
}
void Page::init() {
- LeadActor::State state = _leadActor->getState();
- bool unk = (state == LeadActor::kInventory || state == LeadActor::kPDA);
+ LeadActor::State state = _leadActor->getState();
+ bool unk = (state == LeadActor::kInventory || state == LeadActor::kPDA);
- for (uint i = 0; i < _actors.size(); ++i) {
- _actors[i]->init(unk);
- }
+ for (uint i = 0; i < _actors.size(); ++i) {
+ _actors[i]->init(unk);
+ }
}
LeadActor *Page::getLeadActor() {
- return _leadActor;
+ return _leadActor;
}
void Page::clear() {
- for (uint i = 0; i < _actors.size(); ++i) {
- delete _actors[i];
- }
- _actors.clear();
- _resMgr.clear();
+ for (uint i = 0; i < _actors.size(); ++i) {
+ delete _actors[i];
+ }
+ _actors.clear();
+ _resMgr.clear();
}
void Page::pause() {
- for (uint i = 0; i < _actors.size(); ++i) {
- _actors[i]->pause();
- }
+ for (uint i = 0; i < _actors.size(); ++i) {
+ _actors[i]->pause();
+ }
}
void Page::unpause() {
- for (uint i = 0; i < _actors.size(); ++i) {
- _actors[i]->unpause();
- }
+ for (uint i = 0; i < _actors.size(); ++i) {
+ _actors[i]->unpause();
+ }
}
} // End of namespace Pink
diff --git a/engines/pink/objects/pages/page.h b/engines/pink/objects/pages/page.h
index 1d96a93b5a..3b5708f530 100644
--- a/engines/pink/objects/pages/page.h
+++ b/engines/pink/objects/pages/page.h
@@ -34,26 +34,26 @@ class LeadActor;
class Page : public NamedObject {
public:
- ~Page();
- virtual void toConsole();
+ ~Page();
+ virtual void toConsole();
- void load(Archive &archive);
- Actor *findActor(const Common::String &name);
- LeadActor *getLeadActor();
+ void load(Archive &archive);
+ Actor *findActor(const Common::String &name);
+ LeadActor *getLeadActor();
- Sound *loadSound(Common::String &fileName);
- CelDecoder *loadCel(Common::String &fileName);
+ Sound *loadSound(Common::String &fileName);
+ CelDecoder *loadCel(Common::String &fileName);
- virtual void clear();
- void pause();
- void unpause();
+ virtual void clear();
+ void pause();
+ void unpause();
protected:
- void init();
+ void init();
- Array<Actor*> _actors;
- ResourceMgr _resMgr;
- LeadActor *_leadActor;
+ Array<Actor*> _actors;
+ ResourceMgr _resMgr;
+ LeadActor *_leadActor;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/sequences/seq_timer.cpp b/engines/pink/objects/sequences/seq_timer.cpp
index 974056a956..9f8ee31a4c 100644
--- a/engines/pink/objects/sequences/seq_timer.cpp
+++ b/engines/pink/objects/sequences/seq_timer.cpp
@@ -32,30 +32,30 @@
namespace Pink {
SeqTimer::SeqTimer()
- : _updatesToMessage(0) {}
+ : _updatesToMessage(0) {}
void SeqTimer::deserialize(Archive &archive) {
- _actor = archive.readString();
- _period = archive.readDWORD();
- _range = archive.readDWORD();
- _sequencer = static_cast<Sequencer*>(archive.readObject());
+ _actor = archive.readString();
+ _period = archive.readDWORD();
+ _range = archive.readDWORD();
+ _sequencer = static_cast<Sequencer*>(archive.readObject());
}
void SeqTimer::toConsole() {
- debug("\tSeqTimer: _actor=%s _period=%u _range=%u", _actor.c_str(), _period, _range);
+ debug("\tSeqTimer: _actor=%s _period=%u _range=%u", _actor.c_str(), _period, _range);
}
void SeqTimer::update() {
- Common::RandomSource &rnd =_sequencer->_page->getGame()->getRnd();
- if (_updatesToMessage--)
- return;
+ Common::RandomSource &rnd =_sequencer->_page->getGame()->getRnd();
+ if (_updatesToMessage--)
+ return;
_updatesToMessage = _range ? _period + rnd.getRandomNumber(_range) : _period;
SupportingActor *actor = static_cast<SupportingActor*>(_sequencer->_page->findActor(_actor));
- if (actor && !_sequencer->findSequenceActorState(actor->getName())){
- actor->onTimerMessage();
- }
+ if (actor && !_sequencer->findSequenceActorState(actor->getName())){
+ actor->onTimerMessage();
+ }
}
} // End of namespace Pink
diff --git a/engines/pink/objects/sequences/seq_timer.h b/engines/pink/objects/sequences/seq_timer.h
index bfd6295ce0..9af706f6c8 100644
--- a/engines/pink/objects/sequences/seq_timer.h
+++ b/engines/pink/objects/sequences/seq_timer.h
@@ -31,17 +31,17 @@ class Sequencer;
class SeqTimer : public Object {
public:
- SeqTimer();
- virtual void deserialize(Archive &archive);
- virtual void toConsole();
- virtual void update();
+ SeqTimer();
+ virtual void deserialize(Archive &archive);
+ virtual void toConsole();
+ virtual void update();
private:
- Common::String _actor;
- Sequencer *_sequencer;
- int _period;
- int _range;
- int _updatesToMessage;
+ Common::String _actor;
+ Sequencer *_sequencer;
+ int _period;
+ int _range;
+ int _updatesToMessage;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/sequences/sequence.cpp b/engines/pink/objects/sequences/sequence.cpp
index 1e08bb5c02..5eeae68657 100644
--- a/engines/pink/objects/sequences/sequence.cpp
+++ b/engines/pink/objects/sequences/sequence.cpp
@@ -34,158 +34,158 @@
namespace Pink {
Sequence::Sequence()
- : _unk(0), _context(nullptr),
- _sequencer(nullptr) {}
+ : _unk(0), _context(nullptr),
+ _sequencer(nullptr) {}
Sequence::~Sequence() {
- for (uint i = 0; i < _items.size(); ++i) {
- delete _items[i];
- }
+ for (uint i = 0; i < _items.size(); ++i) {
+ delete _items[i];
+ }
}
void Sequence::deserialize(Archive &archive) {
- NamedObject::deserialize(archive);
- _sequencer = static_cast<Sequencer*>(archive.readObject());
- _items.deserialize(archive);
+ NamedObject::deserialize(archive);
+ _sequencer = static_cast<Sequencer*>(archive.readObject());
+ _items.deserialize(archive);
}
void Sequence::toConsole() {
- debug("\t\tSequence %s", _name.c_str());
- debug("\t\t\tItems:");
- for (uint i = 0; i < _items.size(); ++i) {
- _items[i]->toConsole();
- }
+ debug("\t\tSequence %s", _name.c_str());
+ debug("\t\t\tItems:");
+ for (uint i = 0; i < _items.size(); ++i) {
+ _items[i]->toConsole();
+ }
}
Common::Array<SequenceItem*> &Sequence::getItems() {
- return _items;
+ return _items;
}
void Sequence::setContext(SequenceContext *context) {
- _context = context;
+ _context = context;
}
void Sequence::init(int unk) {
- assert(_items.size());
- assert(dynamic_cast<SequenceItemLeader*>(_items[0])); // first item must always be a leader
- start(unk);
+ assert(_items.size());
+ assert(dynamic_cast<SequenceItemLeader*>(_items[0])); // first item must always be a leader
+ start(unk);
}
void Sequence::start(int unk) {
- if (_context->_nextItemIndex >= _items.size() || !_items[_context->_nextItemIndex]->execute(_context->_index, this, unk)){
- debug("Sequence %s ended", _name.c_str());
- end();
- return;
- }
+ if (_context->_nextItemIndex >= _items.size() || !_items[_context->_nextItemIndex]->execute(_context->_index, this, unk)){
+ debug("Sequence %s ended", _name.c_str());
+ end();
+ return;
+ }
- uint i;
- for (i = _context->_nextItemIndex + 1; i <_items.size(); ++i){
- if (_items[i]->isLeader())
- break;
- _items[i]->execute(_context->_index, this, unk);
- }
- _context->_nextItemIndex = i;
+ uint i;
+ for (i = _context->_nextItemIndex + 1; i <_items.size(); ++i){
+ if (_items[i]->isLeader())
+ break;
+ _items[i]->execute(_context->_index, this, unk);
+ }
+ _context->_nextItemIndex = i;
- Common::Array<SequenceActorState> &states = _context->_states;
- for (uint j = 0; j < states.size(); ++j) {
- states[j].check(_context->_index, this, unk);
- }
- _context->_index++;
+ Common::Array<SequenceActorState> &states = _context->_states;
+ for (uint j = 0; j < states.size(); ++j) {
+ states[j].check(_context->_index, this, unk);
+ }
+ _context->_index++;
}
void Sequence::update() {
- if (!_context->_actor->isPlaying()){
- debug("Sequence step ended");
- start(0);
- }
+ if (!_context->_actor->isPlaying()){
+ debug("Sequence step ended");
+ start(0);
+ }
}
void Sequence::end() {
- _context->_actor = 0;
- _unk = 1;
- _sequencer->removeContext(_context);
+ _context->_actor = 0;
+ _unk = 1;
+ _sequencer->removeContext(_context);
}
void Sequence::restart() {
- _context->setNextItemIndex(0);
- _context->clearActionsFromActorStates();
- start(0);
+ _context->setNextItemIndex(0);
+ _context->clearActionsFromActorStates();
+ start(0);
}
void Sequence::skipToLastSubSequence() {
- if (_unk && _context->getNextItemIndex() < _items.size()){
- int i = _items.size() - 1;
- while(i >= 0 && !_items[--i]->isLeader());
- assert(i >= 0);
- _context->setNextItemIndex(i);
- _context->clearActionsFromActorStates();
- skipItemsTo(i);
- start(0);
- }
+ if (_unk && _context->getNextItemIndex() < _items.size()){
+ int i = _items.size() - 1;
+ while(i >= 0 && !_items[--i]->isLeader());
+ assert(i >= 0);
+ _context->setNextItemIndex(i);
+ _context->clearActionsFromActorStates();
+ skipItemsTo(i);
+ start(0);
+ }
}
void Sequence::skipItemsTo(int index) {
- for(int i = 0; i < index; ++i){
- _items[i]->skip(this);
- }
+ for(int i = 0; i < index; ++i){
+ _items[i]->skip(this);
+ }
}
void Sequence::skipSubSequence() {
- if (_context->getNextItemIndex() < _context->getSequence()->getItems().size())
- _context->getSequence()->start(0);
+ if (_context->getNextItemIndex() < _context->getSequence()->getItems().size())
+ _context->getSequence()->start(0);
}
void SequenceAudio::deserialize(Archive &archive) {
- Sequence::deserialize(archive);
- _soundName = archive.readString();
+ Sequence::deserialize(archive);
+ _soundName = archive.readString();
}
void SequenceAudio::toConsole() {
- debug("\t\tSequenceAudio %s : _sound = %s", _name.c_str(), _soundName.c_str());
- debug("\t\t\tItems:");
- for (uint i = 0; i < _items.size(); ++i) {
- _items[i]->toConsole();
- }
+ debug("\t\tSequenceAudio %s : _sound = %s", _name.c_str(), _soundName.c_str());
+ debug("\t\t\tItems:");
+ for (uint i = 0; i < _items.size(); ++i) {
+ _items[i]->toConsole();
+ }
}
void SequenceAudio::start(int unk) {
- Sequence::start(unk);
- uint index = _context->getNextItemIndex();
- if (index < _items.size()) {
- SequenceItemLeaderAudio* leaderAudio = (SequenceItemLeaderAudio*) _items[index];
- _sample = leaderAudio->getSample();
- }
+ Sequence::start(unk);
+ uint index = _context->getNextItemIndex();
+ if (index < _items.size()) {
+ SequenceItemLeaderAudio* leaderAudio = (SequenceItemLeaderAudio*) _items[index];
+ _sample = leaderAudio->getSample();
+ }
}
void SequenceAudio::end() {
- delete _sound;
- _sound = nullptr;
- Sequence::end();
+ delete _sound;
+ _sound = nullptr;
+ Sequence::end();
}
void SequenceAudio::update() {
- if (!_sound->isPlaying())
- end();
- else if (_sample <= _sound->getCurrentSample()){
- start(0);
- }
+ if (!_sound->isPlaying())
+ end();
+ else if (_sample <= _sound->getCurrentSample()){
+ start(0);
+ }
}
void SequenceAudio::init(int unk) {
- _sample = 0;
- _sound = _sequencer->_page->loadSound(_soundName);
- _sound->play(Audio::Mixer::SoundType::kMusicSoundType, 100, 0);
- Sequence::init(unk);
+ _sample = 0;
+ _sound = _sequencer->_page->loadSound(_soundName);
+ _sound->play(Audio::Mixer::SoundType::kMusicSoundType, 100, 0);
+ Sequence::init(unk);
}
void SequenceAudio::restart() {
- _sound->play(Audio::Mixer::SoundType::kMusicSoundType, 100, 0);
- Sequence::restart();
+ _sound->play(Audio::Mixer::SoundType::kMusicSoundType, 100, 0);
+ Sequence::restart();
}
void SequenceAudio::skipToLastSubSequence() {
- end();
+ end();
}
} // End of namespace Pink
diff --git a/engines/pink/objects/sequences/sequence.h b/engines/pink/objects/sequences/sequence.h
index e40b0160e2..f4c6c5a1b3 100644
--- a/engines/pink/objects/sequences/sequence.h
+++ b/engines/pink/objects/sequences/sequence.h
@@ -33,54 +33,54 @@ class SequenceContext;
class Sequence : public NamedObject {
public:
- Sequence();
- virtual ~Sequence();
- virtual void deserialize(Archive &archive);
+ Sequence();
+ virtual ~Sequence();
+ virtual void deserialize(Archive &archive);
- virtual void toConsole();
+ virtual void toConsole();
- Common::Array<SequenceItem*> &getItems();
+ Common::Array<SequenceItem*> &getItems();
- void setContext(SequenceContext *context);
- virtual void init(int unk);
- virtual void start(int unk);
- virtual void end();
+ void setContext(SequenceContext *context);
+ virtual void init(int unk);
+ virtual void start(int unk);
+ virtual void end();
- virtual void update();
- virtual void restart();
- virtual void skipSubSequence();
- virtual void skipToLastSubSequence();
- void skipItemsTo(int index);
+ virtual void update();
+ virtual void restart();
+ virtual void skipSubSequence();
+ virtual void skipToLastSubSequence();
+ void skipItemsTo(int index);
public:
- SequenceContext *_context;
- Sequencer *_sequencer;
- Array<SequenceItem*> _items;
- int _unk;
+ SequenceContext *_context;
+ Sequencer *_sequencer;
+ Array<SequenceItem*> _items;
+ int _unk;
};
class Sound;
class SequenceAudio : public Sequence {
public:
- virtual void deserialize(Archive &archive);
- virtual void toConsole();
+ virtual void deserialize(Archive &archive);
+ virtual void toConsole();
- virtual void init(int unk);
- virtual void start(int unk);
- virtual void end();
+ virtual void init(int unk);
+ virtual void start(int unk);
+ virtual void end();
- virtual void update();
- virtual void restart();
+ virtual void update();
+ virtual void restart();
- virtual void skipSubSequence() {};
- virtual void skipToLastSubSequence();
+ virtual void skipSubSequence() {};
+ virtual void skipToLastSubSequence();
private:
- Common::String _soundName;
- Sound *_sound;
- uint _sample;
+ Common::String _soundName;
+ Sound *_sound;
+ uint _sample;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/sequences/sequence_context.cpp b/engines/pink/objects/sequences/sequence_context.cpp
index 8ce85b7273..48cbfedfc5 100644
--- a/engines/pink/objects/sequences/sequence_context.cpp
+++ b/engines/pink/objects/sequences/sequence_context.cpp
@@ -32,62 +32,62 @@
namespace Pink {
SequenceActorState::SequenceActorState(const Common::String &name)
- :_actorName(name), _index(0)
+ :_actorName(name), _index(0)
{}
const Common::String &SequenceActorState::getActor() const {
- return _actorName;
+ return _actorName;
}
void SequenceActorState::check(int index, Sequence *sequence, bool unk) {
- Actor *actor = sequence->_sequencer->_page->findActor(_actorName);
- debug("%s %s", _actorName.c_str(), _actionName.c_str());
- if (_index != index && !_actionName.empty()){
- Action *action = actor->findAction(_actionName);
- if (actor->getAction() != action)
- actor->setAction(action, unk);
- }
+ Actor *actor = sequence->_sequencer->_page->findActor(_actorName);
+ debug("%s %s", _actorName.c_str(), _actionName.c_str());
+ if (_index != index && !_actionName.empty()){
+ Action *action = actor->findAction(_actionName);
+ if (actor->getAction() != action)
+ actor->setAction(action, unk);
+ }
}
SequenceContext::SequenceContext(Sequence *sequence, Sequencer *sequencer)
- : _sequence(sequence), _sequencer(sequencer),
- _nextItemIndex(0), _index(1), _actor(nullptr)
+ : _sequence(sequence), _sequencer(sequencer),
+ _nextItemIndex(0), _index(1), _actor(nullptr)
{
- sequence->setContext(this);
- Common::Array<SequenceItem*> &items = sequence->getItems();
- debug("SequenceContext for %s", _sequence->getName().c_str());
+ sequence->setContext(this);
+ Common::Array<SequenceItem*> &items = sequence->getItems();
+ debug("SequenceContext for %s", _sequence->getName().c_str());
- for (uint i = 0; i < items.size(); ++i) {
- bool found = 0;
- for (uint j = 0; j < _states.size(); ++j) {
- if (items[i]->getActor() == _states[j].getActor()){
- found = 1;
- break;
- }
- }
- if (!found) {
- debug(items[i]->getActor().c_str());
- _states.push_back({items[i]->getActor()});
- }
- }
+ for (uint i = 0; i < items.size(); ++i) {
+ bool found = 0;
+ for (uint j = 0; j < _states.size(); ++j) {
+ if (items[i]->getActor() == _states[j].getActor()){
+ found = 1;
+ break;
+ }
+ }
+ if (!found) {
+ debug(items[i]->getActor().c_str());
+ _states.push_back({items[i]->getActor()});
+ }
+ }
}
uint SequenceContext::getNextItemIndex() const {
- return _nextItemIndex;
+ return _nextItemIndex;
}
Sequence *SequenceContext::getSequence() const {
- return _sequence;
+ return _sequence;
}
void SequenceContext::clearActionsFromActorStates() {
- for (uint i = 0; i < _states.size(); ++i) {
- _states[i]._actionName.clear();
- }
+ for (uint i = 0; i < _states.size(); ++i) {
+ _states[i]._actionName.clear();
+ }
}
void SequenceContext::setNextItemIndex(int index) {
- _nextItemIndex = index;
+ _nextItemIndex = index;
}
} // End of namespace Pink
diff --git a/engines/pink/objects/sequences/sequence_context.h b/engines/pink/objects/sequences/sequence_context.h
index 334553cf57..e7acf093ea 100644
--- a/engines/pink/objects/sequences/sequence_context.h
+++ b/engines/pink/objects/sequences/sequence_context.h
@@ -32,37 +32,37 @@ class Sequencer;
class SequenceActorState {
public:
- SequenceActorState(const Common::String &name);
+ SequenceActorState(const Common::String &name);
- const Common::String &getActor() const;
- void check(int index, Sequence *sequence, bool unk);
+ const Common::String &getActor() const;
+ void check(int index, Sequence *sequence, bool unk);
public:
- Common::String _actorName;
- Common::String _actionName;
- int _index;
+ Common::String _actorName;
+ Common::String _actionName;
+ int _index;
};
class Actor;
class SequenceContext {
public:
- SequenceContext(Sequence *sequence, Sequencer* sequencer);
+ SequenceContext(Sequence *sequence, Sequencer* sequencer);
- uint getNextItemIndex() const;
- Sequence *getSequence() const;
+ uint getNextItemIndex() const;
+ Sequence *getSequence() const;
- void setNextItemIndex(int index);
+ void setNextItemIndex(int index);
- void clearActionsFromActorStates();
+ void clearActionsFromActorStates();
public:
- Sequence *_sequence;
- Sequencer *_sequencer;
- uint _nextItemIndex;
- Actor *_actor;
- Common::Array<SequenceActorState> _states;
- int _index;
+ Sequence *_sequence;
+ Sequencer *_sequencer;
+ uint _nextItemIndex;
+ Actor *_actor;
+ Common::Array<SequenceActorState> _states;
+ int _index;
};
}
diff --git a/engines/pink/objects/sequences/sequence_item.cpp b/engines/pink/objects/sequences/sequence_item.cpp
index a530390f97..7cc3f1b153 100644
--- a/engines/pink/objects/sequences/sequence_item.cpp
+++ b/engines/pink/objects/sequences/sequence_item.cpp
@@ -34,77 +34,77 @@
namespace Pink {
void SequenceItem::deserialize(Archive &archive) {
- _actor = archive.readString();
- _action = archive.readString();
+ _actor = archive.readString();
+ _action = archive.readString();
}
void SequenceItem::toConsole() {
- debug("\t\t\t\tSequenceItem: _actor=%s, _action=%s", _actor.c_str(), _action.c_str());
+ debug("\t\t\t\tSequenceItem: _actor=%s, _action=%s", _actor.c_str(), _action.c_str());
}
const Common::String &SequenceItem::getActor() const {
- return _actor;
+ return _actor;
}
const Common::String &SequenceItem::getAction() const {
- return _action;
+ return _action;
}
bool SequenceItem::execute(int index, Sequence *sequence, bool unk2) {
- Actor *actor;
- Action *action;
- if (!(actor = sequence->_sequencer->_page->findActor(_actor)) ||
- !(action = actor->findAction(_action))) {
- return false;
- }
+ Actor *actor;
+ Action *action;
+ if (!(actor = sequence->_sequencer->_page->findActor(_actor)) ||
+ !(action = actor->findAction(_action))) {
+ return false;
+ }
- actor->setAction(action, unk2);
+ actor->setAction(action, unk2);
- SequenceActorState *state = sequence->_sequencer->findSequenceActorState(_actor);
- state->_index = index;
- sequence->_context->_actor = isLeader() ? actor : sequence->_context->_actor;
+ SequenceActorState *state = sequence->_sequencer->findSequenceActorState(_actor);
+ state->_index = index;
+ sequence->_context->_actor = isLeader() ? actor : sequence->_context->_actor;
- return true;
+ return true;
}
bool SequenceItem::isLeader() {
- return false;
+ return false;
}
bool SequenceItemLeader::isLeader() {
- return true;
+ return true;
}
void SequenceItemLeader::toConsole() {
- debug("\t\t\t\tSequenceItemLeader: _actor=%s, _action=%s", _actor.c_str(), _action.c_str());
+ debug("\t\t\t\tSequenceItemLeader: _actor=%s, _action=%s", _actor.c_str(), _action.c_str());
}
void SequenceItemLeaderAudio::deserialize(Archive &archive) {
- SequenceItem::deserialize(archive);
- _sample = archive.readDWORD();
+ SequenceItem::deserialize(archive);
+ _sample = archive.readDWORD();
}
void SequenceItemLeaderAudio::toConsole() {
- debug("\t\t\t\tSequenceItemLeaderAudio: _actor=%s, _action=%s _sample=%d", _actor.c_str(), _action.c_str(), _sample);
+ debug("\t\t\t\tSequenceItemLeaderAudio: _actor=%s, _action=%s _sample=%d", _actor.c_str(), _action.c_str(), _sample);
}
uint32 SequenceItemLeaderAudio::getSample() {
- return _sample;
+ return _sample;
}
bool SequenceItemDefaultAction::execute(int index, Sequence *sequence, bool unk2) {
- SequenceActorState *state = sequence->_sequencer->findSequenceActorState(_actor);
- state->_actionName = _action;
- return true;
+ SequenceActorState *state = sequence->_sequencer->findSequenceActorState(_actor);
+ state->_actionName = _action;
+ return true;
}
void SequenceItemDefaultAction::toConsole() {
- debug("\t\t\t\tSequenceItemDefaultAction: _actor=%s, _action=%s", _actor.c_str(), _action.c_str());
+ debug("\t\t\t\tSequenceItemDefaultAction: _actor=%s, _action=%s", _actor.c_str(), _action.c_str());
}
void SequenceItemDefaultAction::skip(Sequence *sequence) {
- execute(0, sequence, 1);
+ execute(0, sequence, 1);
}
} // End of namespace Pink
diff --git a/engines/pink/objects/sequences/sequence_item.h b/engines/pink/objects/sequences/sequence_item.h
index dd026a87d9..df22f86fe5 100644
--- a/engines/pink/objects/sequences/sequence_item.h
+++ b/engines/pink/objects/sequences/sequence_item.h
@@ -31,53 +31,53 @@ class Sequence;
class SequenceItem : public Object {
public:
- virtual void deserialize(Archive &archive);
+ virtual void deserialize(Archive &archive);
- virtual void toConsole();
+ virtual void toConsole();
- const Common::String &getActor() const;
- const Common::String &getAction() const;
+ const Common::String &getActor() const;
+ const Common::String &getAction() const;
- virtual bool execute(int index, Sequence *sequence, bool unk2);
- virtual bool isLeader();
- virtual void skip(Sequence *sequence) {};
+ virtual bool execute(int index, Sequence *sequence, bool unk2);
+ virtual bool isLeader();
+ virtual void skip(Sequence *sequence) {};
protected:
- Common::String _actor;
- Common::String _action;
+ Common::String _actor;
+ Common::String _action;
};
class SequenceItemLeader : public SequenceItem {
public:
- virtual void toConsole();
- virtual bool isLeader();
+ virtual void toConsole();
+ virtual bool isLeader();
};
class SequenceItemLeaderAudio : public SequenceItemLeader {
public:
- virtual void deserialize(Archive &archive);
- virtual void toConsole();
- uint32 getSample();
+ virtual void deserialize(Archive &archive);
+ virtual void toConsole();
+ uint32 getSample();
private:
- uint32 _sample;
+ uint32 _sample;
};
class SequenceItemDefaultAction : public SequenceItem {
public:
- virtual bool execute(int index, Sequence *sequence, bool unk2);
- virtual void skip(Sequence *sequence);
+ virtual bool execute(int index, Sequence *sequence, bool unk2);
+ virtual void skip(Sequence *sequence);
- virtual void toConsole();
+ virtual void toConsole();
};
/* not used in games but is implemented in engine
class SequenceItemSideEffects : public SequenceItemDefaultAction {
public:
- virtual void deserialize(Archive &archive);
- virtual bool execute(int unk, Sequence *sequence, bool unk2);
+ virtual void deserialize(Archive &archive);
+ virtual bool execute(int unk, Sequence *sequence, bool unk2);
private
- Common::Array<SideEffect*> _sideEffects
+ Common::Array<SideEffect*> _sideEffects
};
*/
diff --git a/engines/pink/objects/sequences/sequencer.cpp b/engines/pink/objects/sequences/sequencer.cpp
index 5644aa8f25..430c8c2da0 100644
--- a/engines/pink/objects/sequences/sequencer.cpp
+++ b/engines/pink/objects/sequences/sequencer.cpp
@@ -34,18 +34,18 @@
namespace Pink {
Sequencer::Sequencer(GamePage *page)
- : _context(nullptr), _page(page), _time(0)
+ : _context(nullptr), _page(page), _time(0)
{}
Sequencer::~Sequencer() {
- for (uint i = 0; i < _sequences.size(); ++i) {
- delete _sequences[i];
- }
+ for (uint i = 0; i < _sequences.size(); ++i) {
+ delete _sequences[i];
+ }
}
void Sequencer::deserialize(Archive &archive) {
- _sequences.deserialize(archive);
- _timers.deserialize(archive);
+ _sequences.deserialize(archive);
+ _timers.deserialize(archive);
}
Sequence *Sequencer::findSequence(const Common::String &name) {
@@ -57,75 +57,75 @@ Sequence *Sequencer::findSequence(const Common::String &name) {
}
void Sequencer::authorSequence(Sequence *sequence, bool unk) {
- if (_context){
+ if (_context){
- }
+ }
- if (sequence){
- _context = new SequenceContext(sequence, this);
- //unload array of unknown objects
- _currentSequenceName = sequence->getName();
- sequence->init(unk);
- }
- else _currentSequenceName.clear();
+ if (sequence){
+ _context = new SequenceContext(sequence, this);
+ //unload array of unknown objects
+ _currentSequenceName = sequence->getName();
+ sequence->init(unk);
+ }
+ else _currentSequenceName.clear();
}
void Sequencer::toConsole() {
- debug("Sequencer:");
- for (uint i = 0; i < _sequences.size(); ++i) {
- _sequences[i]->toConsole();
- }
- for (uint i = 0; i < _timers.size(); ++i) {
- _timers[i]->toConsole();
- }
+ debug("Sequencer:");
+ for (uint i = 0; i < _sequences.size(); ++i) {
+ _sequences[i]->toConsole();
+ }
+ for (uint i = 0; i < _timers.size(); ++i) {
+ _timers[i]->toConsole();
+ }
}
void Sequencer::update() {
- if (_context)
- _context->_sequence->update();
- updateTimers();
+ if (_context)
+ _context->_sequence->update();
+ updateTimers();
}
void Sequencer::removeContext(SequenceContext *context) {
- delete _context;
- _context = nullptr;
+ delete _context;
+ _context = nullptr;
}
void Sequencer::skipSubSequence() {
- if (_context)
- _context->getSequence()->skipSubSequence();
+ if (_context)
+ _context->getSequence()->skipSubSequence();
}
void Sequencer::restartSequence() {
- _context->getSequence()->restart();
+ _context->getSequence()->restart();
}
void Sequencer::skipToLastSubSequence() {
- _context->getSequence()->skipToLastSubSequence();
+ _context->getSequence()->skipToLastSubSequence();
}
void Sequencer::updateTimers() {
- uint time = _page->getGame()->getTotalPlayTime();
- if (time - _time <= kTimersUpdateTime) {
- return;
- }
-
- _time = time;
- for (uint i = 0; i < _timers.size(); ++i) {
- _timers[i]->update();
- }
+ uint time = _page->getGame()->getTotalPlayTime();
+ if (time - _time <= kTimersUpdateTime) {
+ return;
+ }
+
+ _time = time;
+ for (uint i = 0; i < _timers.size(); ++i) {
+ _timers[i]->update();
+ }
}
SequenceActorState *Sequencer::findSequenceActorState(const Common::String &name) {
- if (!_context)
- return nullptr;
+ if (!_context)
+ return nullptr;
- for (uint i = 0; i < _context->_states.size(); ++i) {
- if (_context->_states[i].getActor() == name)
- return &_context->_states[i];
- }
+ for (uint i = 0; i < _context->_states.size(); ++i) {
+ if (_context->_states[i].getActor() == name)
+ return &_context->_states[i];
+ }
- return nullptr;
+ return nullptr;
}
} // End of namespace Pink
diff --git a/engines/pink/objects/sequences/sequencer.h b/engines/pink/objects/sequences/sequencer.h
index 0213728bac..c1b957b995 100644
--- a/engines/pink/objects/sequences/sequencer.h
+++ b/engines/pink/objects/sequences/sequencer.h
@@ -35,36 +35,36 @@ class SequenceActorState;
class Sequencer : public Object {
public:
- Sequencer(GamePage *page);
- ~Sequencer();
+ Sequencer(GamePage *page);
+ ~Sequencer();
- virtual void toConsole();
+ virtual void toConsole();
- virtual void deserialize(Archive &archive);
- Sequence* findSequence(const Common::String &name);
- SequenceActorState *findSequenceActorState(const Common::String &name);
+ virtual void deserialize(Archive &archive);
+ Sequence* findSequence(const Common::String &name);
+ SequenceActorState *findSequenceActorState(const Common::String &name);
- void authorSequence(Sequence *sequence, bool unk);
+ void authorSequence(Sequence *sequence, bool unk);
- void removeContext(SequenceContext *context);
+ void removeContext(SequenceContext *context);
- void update();
+ void update();
- void skipSubSequence();
- void restartSequence();
- void skipToLastSubSequence();
+ void skipSubSequence();
+ void restartSequence();
+ void skipToLastSubSequence();
public:
- void updateTimers();
+ void updateTimers();
- SequenceContext *_context;
- // context array
- Array<Sequence*> _sequences;
- Array<SeqTimer*> _timers;
+ SequenceContext *_context;
+ // context array
+ Array<Sequence*> _sequences;
+ Array<SeqTimer*> _timers;
Common::String _currentSequenceName;
GamePage *_page;
- uint _time;
+ uint _time;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/side_effect.cpp b/engines/pink/objects/side_effect.cpp
index 228b8d5dc8..3bf67e15f8 100644
--- a/engines/pink/objects/side_effect.cpp
+++ b/engines/pink/objects/side_effect.cpp
@@ -33,59 +33,59 @@
namespace Pink {
void SideEffectExit::deserialize(Archive &archive) {
- _nextModule = archive.readString();
- _nextPage = archive.readString();
+ _nextModule = archive.readString();
+ _nextPage = archive.readString();
}
void SideEffectExit::execute(Actor *actor) {
- actor->getPage()->getLeadActor()->setNextExecutors(_nextModule, _nextPage);
+ actor->getPage()->getLeadActor()->setNextExecutors(_nextModule, _nextPage);
}
void SideEffectExit::toConsole() {
- debug("\t\tSideEffectExit: _nextModule=%s, _nextPage=%s", _nextModule.c_str(), _nextPage.c_str());
+ debug("\t\tSideEffectExit: _nextModule=%s, _nextPage=%s", _nextModule.c_str(), _nextPage.c_str());
}
void SideEffectLocation::deserialize(Archive &archive) {
- _location = archive.readString();
+ _location = archive.readString();
}
void SideEffectLocation::execute(Actor *actor) {
- WalkMgr *mgr = actor->getPage()->getWalkMgr();
- WalkLocation *location = mgr->findLocation(_location);
- if (location)
- mgr->setCurrentWayPoint(location);
+ WalkMgr *mgr = actor->getPage()->getWalkMgr();
+ WalkLocation *location = mgr->findLocation(_location);
+ if (location)
+ mgr->setCurrentWayPoint(location);
}
void SideEffectLocation::toConsole() {
- debug("\t\tSideEffectLocation: _location=%s", _location.c_str());
+ debug("\t\tSideEffectLocation: _location=%s", _location.c_str());
}
void SideEffectInventoryItemOwner::deserialize(Archive &archive) {
- _item = archive.readString();
- _owner = archive.readString();
+ _item = archive.readString();
+ _owner = archive.readString();
}
void SideEffectInventoryItemOwner::execute(Actor *actor) {
- InventoryMgr *mgr = actor->getPage()->getModule()->getInventoryMgr();
- InventoryItem *item = mgr->findInventoryItem(_item);
- mgr->setItemOwner(_owner, item);
+ InventoryMgr *mgr = actor->getPage()->getModule()->getInventoryMgr();
+ InventoryItem *item = mgr->findInventoryItem(_item);
+ mgr->setItemOwner(_owner, item);
}
void SideEffectInventoryItemOwner::toConsole() {
- debug("\t\tSideEffectInventoryItemOwner: _item=%s, _owner=%s", _item.c_str(), _owner.c_str());
+ debug("\t\tSideEffectInventoryItemOwner: _item=%s, _owner=%s", _item.c_str(), _owner.c_str());
}
void SideEffectVariable::deserialize(Pink::Archive &archive) {
- _name = archive.readString();
- _value = archive.readString();
+ _name = archive.readString();
+ _value = archive.readString();
}
void SideEffectGameVariable::execute(Actor *actor) {
- actor->getPage()->getGame()->setVariable(_name, _value);
+ actor->getPage()->getGame()->setVariable(_name, _value);
}
void SideEffectGameVariable::toConsole() {
- debug("\t\tSideEffectGameVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
+ debug("\t\tSideEffectGameVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
}
void SideEffectModuleVariable::execute(Actor *actor) {
@@ -93,39 +93,39 @@ void SideEffectModuleVariable::execute(Actor *actor) {
}
void SideEffectModuleVariable::toConsole() {
- debug("\t\tSideEffectModuleVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
+ debug("\t\tSideEffectModuleVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
}
void SideEffectPageVariable::execute(Actor *actor) {
- actor->getPage()->setVariable(_name, _value);
+ actor->getPage()->setVariable(_name, _value);
}
void SideEffectPageVariable::toConsole() {
- debug("\t\tSideEffectPageVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
+ debug("\t\tSideEffectPageVariable: _name=%s, _value=%s", _name.c_str(), _value.c_str());
}
void SideEffectRandomPageVariable::deserialize(Archive &archive) {
- _name = archive.readString();
+ _name = archive.readString();
_values.deserialize(archive);
}
void SideEffectRandomPageVariable::execute(Actor *actor) {
- assert(!_values.empty());
+ assert(!_values.empty());
- Common::RandomSource &rnd = actor->getPage()->getGame()->getRnd();
- uint index = rnd.getRandomNumber(_values.size() - 1);
+ Common::RandomSource &rnd = actor->getPage()->getGame()->getRnd();
+ uint index = rnd.getRandomNumber(_values.size() - 1);
- actor->getPage()->setVariable(_name, _values[index]);
+ actor->getPage()->setVariable(_name, _values[index]);
}
void SideEffectRandomPageVariable::toConsole() {
- Common::String values("{");
- for (uint i = 0; i < _values.size(); ++i) {
- values += _values[i];
- values += ',';
- }
- values += '}';
- debug("\t\tSideEffectRandomPageVariable: _name=%s, _values=%s", _name.c_str(), values.c_str());
+ Common::String values("{");
+ for (uint i = 0; i < _values.size(); ++i) {
+ values += _values[i];
+ values += ',';
+ }
+ values += '}';
+ debug("\t\tSideEffectRandomPageVariable: _name=%s, _values=%s", _name.c_str(), values.c_str());
}
} // End of namespace Pink
diff --git a/engines/pink/objects/side_effect.h b/engines/pink/objects/side_effect.h
index 1a08d854e5..c917615b93 100644
--- a/engines/pink/objects/side_effect.h
+++ b/engines/pink/objects/side_effect.h
@@ -32,81 +32,81 @@ class Actor;
class SideEffect : public Object {
public:
- virtual void deserialize(Archive &archive) = 0;
- virtual void execute(Actor *actor) = 0;
+ virtual void deserialize(Archive &archive) = 0;
+ virtual void execute(Actor *actor) = 0;
};
class SideEffectExit : public SideEffect {
public:
- virtual void deserialize(Archive &archive);
- virtual void toConsole();
- virtual void execute(Actor *actor);
+ virtual void deserialize(Archive &archive);
+ virtual void toConsole();
+ virtual void execute(Actor *actor);
private:
- Common::String _nextModule;
- Common::String _nextPage;
- Common::StringMap map;
+ Common::String _nextModule;
+ Common::String _nextPage;
+ Common::StringMap map;
};
class SideEffectLocation : public SideEffect {
public:
- virtual void deserialize(Archive &archive);
- virtual void execute(Actor *actor);
- virtual void toConsole();
+ virtual void deserialize(Archive &archive);
+ virtual void execute(Actor *actor);
+ virtual void toConsole();
private:
- Common::String _location;
+ Common::String _location;
};
class SideEffectInventoryItemOwner : public SideEffect {
public:
- virtual void deserialize(Archive &archive);
- virtual void execute(Actor *actor);
- virtual void toConsole();
+ virtual void deserialize(Archive &archive);
+ virtual void execute(Actor *actor);
+ virtual void toConsole();
private:
- Common::String _item;
- Common::String _owner;
+ Common::String _item;
+ Common::String _owner;
};
class SideEffectVariable : public SideEffect {
public:
- virtual void deserialize(Archive &archive);
- virtual void execute(Actor *actor) = 0;
+ virtual void deserialize(Archive &archive);
+ virtual void execute(Actor *actor) = 0;
protected:
- Common::String _name;
- Common::String _value;
+ Common::String _name;
+ Common::String _value;
};
class SideEffectGameVariable : public SideEffectVariable {
public:
- virtual void toConsole();
- virtual void execute(Actor *actor);
+ virtual void toConsole();
+ virtual void execute(Actor *actor);
};
class SideEffectModuleVariable : public SideEffectVariable {
public:
- virtual void toConsole();
- virtual void execute(Actor *actor);
+ virtual void toConsole();
+ virtual void execute(Actor *actor);
};
class SideEffectPageVariable : public SideEffectVariable {
public:
- virtual void toConsole();
- virtual void execute(Actor *actor);
+ virtual void toConsole();
+ virtual void execute(Actor *actor);
};
class SideEffectRandomPageVariable : public SideEffect
{
public:
- virtual void deserialize(Archive &archive);
- virtual void toConsole();
- virtual void execute(Actor *actor);
+ virtual void deserialize(Archive &archive);
+ virtual void toConsole();
+ virtual void execute(Actor *actor);
private:
- Common::String _name;
- StringArray _values;
+ Common::String _name;
+ StringArray _values;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/walk/walk_location.cpp b/engines/pink/objects/walk/walk_location.cpp
index ec2dbc9be9..dd16882396 100644
--- a/engines/pink/objects/walk/walk_location.cpp
+++ b/engines/pink/objects/walk/walk_location.cpp
@@ -28,16 +28,16 @@
namespace Pink {
void WalkLocation::deserialize(Pink::Archive &archive) {
- NamedObject::deserialize(archive);
- _neighbors.deserialize(archive);
+ NamedObject::deserialize(archive);
+ _neighbors.deserialize(archive);
}
void WalkLocation::toConsole() {
- debug("\tWalkLocation: _name =%s", _name.c_str());
- debug("\tNeighbors:");
- for (uint i = 0; i < _neighbors.size(); ++i) {
- debug("\t\t%s", _neighbors[i].c_str());
- }
+ debug("\tWalkLocation: _name =%s", _name.c_str());
+ debug("\tNeighbors:");
+ for (uint i = 0; i < _neighbors.size(); ++i) {
+ debug("\t\t%s", _neighbors[i].c_str());
+ }
}
} // End of namespace Pink
diff --git a/engines/pink/objects/walk/walk_location.h b/engines/pink/objects/walk/walk_location.h
index ef1cbab192..1f77584076 100644
--- a/engines/pink/objects/walk/walk_location.h
+++ b/engines/pink/objects/walk/walk_location.h
@@ -28,12 +28,12 @@ namespace Pink {
class WalkLocation : public NamedObject {
public:
- virtual void deserialize(Archive &archive);
- void toConsole() override;
- Common::StringArray &getNeigbors() { return _neighbors;}
+ virtual void deserialize(Archive &archive);
+ void toConsole() override;
+ Common::StringArray &getNeigbors() { return _neighbors;}
private:
- StringArray _neighbors;
+ StringArray _neighbors;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/walk/walk_mgr.cpp b/engines/pink/objects/walk/walk_mgr.cpp
index 989f69e4af..c9c28f0ffc 100644
--- a/engines/pink/objects/walk/walk_mgr.cpp
+++ b/engines/pink/objects/walk/walk_mgr.cpp
@@ -30,14 +30,14 @@
namespace Pink {
WalkMgr::WalkMgr()
- : _isWalking(false), _leadActor(nullptr)
+ : _isWalking(false), _leadActor(nullptr)
{
}
void WalkMgr::deserialize(Pink::Archive &archive) {
- _leadActor = static_cast<LeadActor *>(archive.readObject());
- _locations.deserialize(archive);
+ _leadActor = static_cast<LeadActor *>(archive.readObject());
+ _locations.deserialize(archive);
}
WalkLocation *WalkMgr::findLocation(const Common::String &name) {
@@ -50,103 +50,103 @@ WalkLocation *WalkMgr::findLocation(const Common::String &name) {
}
void WalkMgr::toConsole() {
- debug("WalkMgr:");
- for (uint i = 0; i < _locations.size(); ++i) {
- _locations[i]->toConsole();
- }
+ debug("WalkMgr:");
+ for (uint i = 0; i < _locations.size(); ++i) {
+ _locations[i]->toConsole();
+ }
}
void WalkMgr::start(WalkLocation *destination) {
- if (_isWalking)
- return;
-
- if (_current.name.empty()) {
- _current.name = _locations[0]->getName();
- _current.coord = getLocationCoordinates(_locations[0]->getName());
- }
-
- _destination = destination;
-
- if (_current.name == _destination->getName()) {
- end();
- }
- else {
- _isWalking = true;
- WalkLocation *currentLocation = findLocation(_current.name);
- WalkShortestPath path(this);
- WalkLocation *nextLocation = path.next(currentLocation, _destination);
- initNextWayPoint(nextLocation);
- _leadActor->setAction(getWalkAction(), 0);
- }
+ if (_isWalking)
+ return;
+
+ if (_current.name.empty()) {
+ _current.name = _locations[0]->getName();
+ _current.coord = getLocationCoordinates(_locations[0]->getName());
+ }
+
+ _destination = destination;
+
+ if (_current.name == _destination->getName()) {
+ end();
+ }
+ else {
+ _isWalking = true;
+ WalkLocation *currentLocation = findLocation(_current.name);
+ WalkShortestPath path(this);
+ WalkLocation *nextLocation = path.next(currentLocation, _destination);
+ initNextWayPoint(nextLocation);
+ _leadActor->setAction(getWalkAction(), 0);
+ }
}
void WalkMgr::initNextWayPoint(WalkLocation *location) {
- _next.name = location->getName();
- _next.coord = getLocationCoordinates(location->getName());
+ _next.name = location->getName();
+ _next.coord = getLocationCoordinates(location->getName());
}
WalkAction *WalkMgr::getWalkAction() {
- Common::String walkActionName;
- if (_current.coord.z == _next.coord.z){
- if (_next.coord.x > _current.coord.x){
- walkActionName = Common::String::format("%dRight", _current.coord.z);
- }
- else walkActionName = Common::String::format("%dLeft", _next.coord.z);
- }
- else walkActionName = Common::String::format("%dTo%d", _current.coord.z, _next.coord.z);
+ Common::String walkActionName;
+ if (_current.coord.z == _next.coord.z){
+ if (_next.coord.x > _current.coord.x){
+ walkActionName = Common::String::format("%dRight", _current.coord.z);
+ }
+ else walkActionName = Common::String::format("%dLeft", _next.coord.z);
+ }
+ else walkActionName = Common::String::format("%dTo%d", _current.coord.z, _next.coord.z);
- Action *action = _leadActor->findAction(walkActionName);
+ Action *action = _leadActor->findAction(walkActionName);
- return static_cast<WalkAction*>(action);
+ return static_cast<WalkAction*>(action);
}
double WalkMgr::getLengthBetweenLocations(WalkLocation *first, WalkLocation *second) {
- Coordinates firstCoord = getLocationCoordinates(first->getName());
- Coordinates secondCoord = getLocationCoordinates(second->getName());
- return sqrt((secondCoord.x - firstCoord.x) * (secondCoord.x - firstCoord.x) +
- (secondCoord.y - firstCoord.y) * (secondCoord.y - firstCoord.y));
+ Coordinates firstCoord = getLocationCoordinates(first->getName());
+ Coordinates secondCoord = getLocationCoordinates(second->getName());
+ return sqrt((secondCoord.x - firstCoord.x) * (secondCoord.x - firstCoord.x) +
+ (secondCoord.y - firstCoord.y) * (secondCoord.y - firstCoord.y));
}
WalkMgr::Coordinates WalkMgr::getLocationCoordinates(const Common::String &locationName) {
- Coordinates coords;
- ActionCEL *action = static_cast<ActionCEL*>(_leadActor->findAction(locationName));
+ Coordinates coords;
+ ActionCEL *action = static_cast<ActionCEL*>(_leadActor->findAction(locationName));
- action->start(0);
- CelDecoder *decoder = action->getDecoder();
+ action->start(0);
+ CelDecoder *decoder = action->getDecoder();
- coords.x = decoder->getX() + decoder->getWidth() / 2;
- coords.y = decoder->getY() + decoder->getHeight() / 2;
- coords.z = action->getZ();
+ coords.x = decoder->getX() + decoder->getWidth() / 2;
+ coords.y = decoder->getY() + decoder->getHeight() / 2;
+ coords.z = action->getZ();
- action->end();
+ action->end();
- return coords;
+ return coords;
}
void WalkMgr::setCurrentWayPoint(WalkLocation *location) {
- _current.name = location->getName();
- _current.coord = getLocationCoordinates(_current.name);
+ _current.name = location->getName();
+ _current.coord = getLocationCoordinates(_current.name);
}
void WalkMgr::update() {
- if (_leadActor->isPlaying())
- return;
-
- WalkShortestPath path(this);
- _current = _next;
- WalkLocation *next = path.next(findLocation(_current.name), _destination);
- if (next){
- initNextWayPoint(next);
- _leadActor->setAction(getWalkAction(), 0);
- }
- else end();
+ if (_leadActor->isPlaying())
+ return;
+
+ WalkShortestPath path(this);
+ _current = _next;
+ WalkLocation *next = path.next(findLocation(_current.name), _destination);
+ if (next){
+ initNextWayPoint(next);
+ _leadActor->setAction(getWalkAction(), 0);
+ }
+ else end();
}
void WalkMgr::end() {
- _isWalking = false;
- _leadActor->onWalkEnd();
+ _isWalking = false;
+ _leadActor->onWalkEnd();
}
} // End of namespace Pink
diff --git a/engines/pink/objects/walk/walk_mgr.h b/engines/pink/objects/walk/walk_mgr.h
index 994796942b..64bd16e48b 100644
--- a/engines/pink/objects/walk/walk_mgr.h
+++ b/engines/pink/objects/walk/walk_mgr.h
@@ -34,39 +34,39 @@ class WalkAction;
class WalkMgr : public Object {
public:
- WalkMgr();
- virtual void deserialize(Archive &archive);
- void toConsole() override;
+ WalkMgr();
+ virtual void deserialize(Archive &archive);
+ void toConsole() override;
- WalkLocation *findLocation(const Common::String &name);
- void start(WalkLocation *destination);
- void update();
+ WalkLocation *findLocation(const Common::String &name);
+ void start(WalkLocation *destination);
+ void update();
- double getLengthBetweenLocations(WalkLocation *first, WalkLocation *second);
- void setCurrentWayPoint(WalkLocation *location);
+ double getLengthBetweenLocations(WalkLocation *first, WalkLocation *second);
+ void setCurrentWayPoint(WalkLocation *location);
private:
- struct Coordinates {
- int x;
- int y;
- int z;
- };
- struct WayPoint {
- Common::String name;
- Coordinates coord;
- };
+ struct Coordinates {
+ int x;
+ int y;
+ int z;
+ };
+ struct WayPoint {
+ Common::String name;
+ Coordinates coord;
+ };
- Coordinates getLocationCoordinates(const Common::String &locationName);
- void end();
- void initNextWayPoint(WalkLocation *location);
- WalkAction *getWalkAction();
+ Coordinates getLocationCoordinates(const Common::String &locationName);
+ void end();
+ void initNextWayPoint(WalkLocation *location);
+ WalkAction *getWalkAction();
- LeadActor *_leadActor;
- WalkLocation *_destination;
- Array<WalkLocation*> _locations;
- WayPoint _current;
- WayPoint _next;
- bool _isWalking;
+ LeadActor *_leadActor;
+ WalkLocation *_destination;
+ Array<WalkLocation*> _locations;
+ WayPoint _current;
+ WayPoint _next;
+ bool _isWalking;
};
} // End of namespace Pink
diff --git a/engines/pink/objects/walk/walk_shortest_path.cpp b/engines/pink/objects/walk/walk_shortest_path.cpp
index 26253235bd..376e638d91 100644
--- a/engines/pink/objects/walk/walk_shortest_path.cpp
+++ b/engines/pink/objects/walk/walk_shortest_path.cpp
@@ -27,134 +27,134 @@
namespace Pink {
WalkShortestPath::WalkShortestPath(WalkMgr *manager)
- : _manager(manager)
+ : _manager(manager)
{}
WalkLocation *WalkShortestPath::next(WalkLocation *start, WalkLocation *destination) {
- if (start == destination)
- return nullptr;
- add(start, 0.0, 0);
- while (build() != destination);
- return getNearestNeighbor(destination);
+ if (start == destination)
+ return nullptr;
+ add(start, 0.0, 0);
+ while (build() != destination);
+ return getNearestNeighbor(destination);
}
void WalkShortestPath::add(WalkLocation *wl, double val, WalkLocation *nearest) {
- _locations.push_back(wl);
- _visited.push_back(wl);
- _weight.push_back(val);
- _nearestNeigbor.push_back(nearest);
+ _locations.push_back(wl);
+ _visited.push_back(wl);
+ _weight.push_back(val);
+ _nearestNeigbor.push_back(nearest);
}
WalkLocation *WalkShortestPath::build() {
- WalkLocation *nearest = nullptr;
- WalkLocation *location = nullptr;
- double len = -1.0;
- addLocationsToVisit();
- for (uint i = 0; i < _toVisit.size(); ++i) {
- double curLen = getLengthToNearestNeigbor(_toVisit[i]);
- if (curLen < 0) {
- remove(_toVisit[i]);
- continue;
- }
- curLen += getWeight(_toVisit[i]);
- if (len < 0.0 || len > curLen) {
- len = curLen;
- location = _toVisit[i];
- nearest = getNearestNeighbor(_toVisit[i]);
- if (!nearest)
- nearest = findNearestNeighbor(_toVisit[i]);
- }
- }
-
- WalkLocation *neighbor = findNearestNeighbor(location);
- if (neighbor)
- add(neighbor, len, nearest);
-
- return neighbor;
+ WalkLocation *nearest = nullptr;
+ WalkLocation *location = nullptr;
+ double len = -1.0;
+ addLocationsToVisit();
+ for (uint i = 0; i < _toVisit.size(); ++i) {
+ double curLen = getLengthToNearestNeigbor(_toVisit[i]);
+ if (curLen < 0) {
+ remove(_toVisit[i]);
+ continue;
+ }
+ curLen += getWeight(_toVisit[i]);
+ if (len < 0.0 || len > curLen) {
+ len = curLen;
+ location = _toVisit[i];
+ nearest = getNearestNeighbor(_toVisit[i]);
+ if (!nearest)
+ nearest = findNearestNeighbor(_toVisit[i]);
+ }
+ }
+
+ WalkLocation *neighbor = findNearestNeighbor(location);
+ if (neighbor)
+ add(neighbor, len, nearest);
+
+ return neighbor;
}
WalkLocation *WalkShortestPath::getNearestNeighbor(WalkLocation *location) {
- for(uint i = 0; i < _visited.size(); ++i){
- if (_visited[i] == location)
- return _nearestNeigbor[i];
- }
+ for(uint i = 0; i < _visited.size(); ++i){
+ if (_visited[i] == location)
+ return _nearestNeigbor[i];
+ }
- return nullptr;
+ return nullptr;
}
void WalkShortestPath::addLocationsToVisit() {
- _toVisit.resize(_locations.size());
- for (uint i = 0; i < _locations.size(); ++i) {
- _toVisit[i] = _locations[i];
- }
+ _toVisit.resize(_locations.size());
+ for (uint i = 0; i < _locations.size(); ++i) {
+ _toVisit[i] = _locations[i];
+ }
}
double WalkShortestPath::getLengthToNearestNeigbor(WalkLocation *location) {
- double minLength = -1.0;
+ double minLength = -1.0;
Common::StringArray &neighbors = location->getNeigbors();
- for (uint i = 0; i < neighbors.size(); ++i) {
- WalkLocation *neighbor = _manager->findLocation(neighbors[i]);
- if (!isLocationVisited(neighbor)){
- double length = _manager->getLengthBetweenLocations(location, neighbor);
- if (minLength >= 0.0) {
- if (length < minLength)
- minLength = length;
- }
- else minLength = length;
- }
- }
-
- return minLength;
+ for (uint i = 0; i < neighbors.size(); ++i) {
+ WalkLocation *neighbor = _manager->findLocation(neighbors[i]);
+ if (!isLocationVisited(neighbor)){
+ double length = _manager->getLengthBetweenLocations(location, neighbor);
+ if (minLength >= 0.0) {
+ if (length < minLength)
+ minLength = length;
+ }
+ else minLength = length;
+ }
+ }
+
+ return minLength;
}
WalkLocation *WalkShortestPath::findNearestNeighbor(WalkLocation *location) {
- double minLength = -1.0;
- WalkLocation *nearest = nullptr;
- Common::StringArray &neighbors = location->getNeigbors();
- for (uint i = 0; i < neighbors.size(); ++i) {
- WalkLocation *neighbor = _manager->findLocation(neighbors[i]);
- if (!isLocationVisited(neighbor)){
- double length = _manager->getLengthBetweenLocations(location, neighbor);
- if (minLength >= 0.0) {
- if (length < minLength) {
- nearest = neighbor;
- minLength = length;
- }
- }
- else {
- nearest = neighbor;
- minLength = length;
- }
- }
- }
-
- return nearest;
+ double minLength = -1.0;
+ WalkLocation *nearest = nullptr;
+ Common::StringArray &neighbors = location->getNeigbors();
+ for (uint i = 0; i < neighbors.size(); ++i) {
+ WalkLocation *neighbor = _manager->findLocation(neighbors[i]);
+ if (!isLocationVisited(neighbor)){
+ double length = _manager->getLengthBetweenLocations(location, neighbor);
+ if (minLength >= 0.0) {
+ if (length < minLength) {
+ nearest = neighbor;
+ minLength = length;
+ }
+ }
+ else {
+ nearest = neighbor;
+ minLength = length;
+ }
+ }
+ }
+
+ return nearest;
}
double WalkShortestPath::getWeight(WalkLocation *location) {
- for (uint i = 0; i < _locations.size(); ++i) {
- if (_locations[i] == location)
- return _weight[i];
- }
- return 0.0;
+ for (uint i = 0; i < _locations.size(); ++i) {
+ if (_locations[i] == location)
+ return _weight[i];
+ }
+ return 0.0;
}
bool WalkShortestPath::isLocationVisited(WalkLocation *location) {
- for (uint i = 0; i < _visited.size(); ++i) {
- if (_visited[i] == location)
- return true;
- }
- return false;
+ for (uint i = 0; i < _visited.size(); ++i) {
+ if (_visited[i] == location)
+ return true;
+ }
+ return false;
}
void WalkShortestPath::remove(WalkLocation *location) {
- for (uint i = 0; i < _locations.size(); ++i) {
- if (_locations[i] == location){
- _locations.remove_at(i);
- _weight.remove_at(i);
- break;
- }
- }
+ for (uint i = 0; i < _locations.size(); ++i) {
+ if (_locations[i] == location){
+ _locations.remove_at(i);
+ _weight.remove_at(i);
+ break;
+ }
+ }
}
} // End of namespace Pink
diff --git a/engines/pink/objects/walk/walk_shortest_path.h b/engines/pink/objects/walk/walk_shortest_path.h
index deb7770061..a3ec85df1d 100644
--- a/engines/pink/objects/walk/walk_shortest_path.h
+++ b/engines/pink/objects/walk/walk_shortest_path.h
@@ -32,27 +32,27 @@ class WalkMgr;
class WalkShortestPath {
public:
- WalkShortestPath(WalkMgr *manager);
- WalkLocation *next(WalkLocation *start, WalkLocation *destination);
+ WalkShortestPath(WalkMgr *manager);
+ WalkLocation *next(WalkLocation *start, WalkLocation *destination);
private:
- void add(WalkLocation *wl, double val, WalkLocation *nearest);
- void remove(WalkLocation *location);
- WalkLocation *build();
- WalkLocation *getNearestNeighbor(WalkLocation *location);
- WalkLocation *findNearestNeighbor(WalkLocation *location);
- double getLengthToNearestNeigbor(WalkLocation *location);
- double getWeight(WalkLocation *location);
- void addLocationsToVisit();
- bool isLocationVisited(WalkLocation *location);
-
-
- WalkMgr *_manager;
- Common::Array<WalkLocation*> _locations;
- Common::Array<WalkLocation*> _toVisit;
- Common::Array<double> _weight;
- Common::Array<WalkLocation*> _visited;
- Common::Array<WalkLocation*> _nearestNeigbor;
+ void add(WalkLocation *wl, double val, WalkLocation *nearest);
+ void remove(WalkLocation *location);
+ WalkLocation *build();
+ WalkLocation *getNearestNeighbor(WalkLocation *location);
+ WalkLocation *findNearestNeighbor(WalkLocation *location);
+ double getLengthToNearestNeigbor(WalkLocation *location);
+ double getWeight(WalkLocation *location);
+ void addLocationsToVisit();
+ bool isLocationVisited(WalkLocation *location);
+
+
+ WalkMgr *_manager;
+ Common::Array<WalkLocation*> _locations;
+ Common::Array<WalkLocation*> _toVisit;
+ Common::Array<double> _weight;
+ Common::Array<WalkLocation*> _visited;
+ Common::Array<WalkLocation*> _nearestNeigbor;
};
} // End of namespace Pink
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index f2b18aa18d..26de1cf6dc 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -37,213 +37,213 @@
namespace Pink {
Pink::PinkEngine::PinkEngine(OSystem *system, const ADGameDescription *desc)
- : Engine(system), _console(nullptr), _rnd("pink"),
- _desc(*desc), _bro(nullptr), _module(nullptr), _director(_system)
+ : Engine(system), _console(nullptr), _rnd("pink"),
+ _desc(*desc), _bro(nullptr), _module(nullptr), _director(_system)
{
- debug("PinkEngine constructed");
+ debug("PinkEngine constructed");
- DebugMan.addDebugChannel(kPinkDebugGeneral, "general", "General issues");
- DebugMan.addDebugChannel(kPinkDebugLoadingObjects, "loading_objects", "Serializing objects from Orb");
- DebugMan.addDebugChannel(kPinkDebugLoadingResources, "loading_resources", "Loading resources data");
- DebugMan.addDebugChannel(kPinkDebugGraphics, "graphics", "Graphics handling");
- DebugMan.addDebugChannel(kPinkDebugSound, "sound", "Sound processing");
+ DebugMan.addDebugChannel(kPinkDebugGeneral, "general", "General issues");
+ DebugMan.addDebugChannel(kPinkDebugLoadingObjects, "loading_objects", "Serializing objects from Orb");
+ DebugMan.addDebugChannel(kPinkDebugLoadingResources, "loading_resources", "Loading resources data");
+ DebugMan.addDebugChannel(kPinkDebugGraphics, "graphics", "Graphics handling");
+ DebugMan.addDebugChannel(kPinkDebugSound, "sound", "Sound processing");
}
Pink::PinkEngine::~PinkEngine() {
- delete _console;
- delete _bro;
- for (uint i = 0; i < _modules.size(); ++i) {
- delete _modules[i];
- }
- for (uint j = 0; j < _cursors.size(); ++j) {
- delete _cursors[j];
- }
-
- DebugMan.clearAllDebugChannels();
+ delete _console;
+ delete _bro;
+ for (uint i = 0; i < _modules.size(); ++i) {
+ delete _modules[i];
+ }
+ for (uint j = 0; j < _cursors.size(); ++j) {
+ delete _cursors[j];
+ }
+
+ DebugMan.clearAllDebugChannels();
}
Common::Error PinkEngine::init() {
- debug("PinkEngine init");
+ debug("PinkEngine init");
- initGraphics(640, 480);
+ initGraphics(640, 480);
- _console = new Console(this);
+ _console = new Console(this);
- const Common::String orbName{_desc.filesDescriptions[0].fileName};
- const Common::String broName{_desc.filesDescriptions[1].fileName};
+ const Common::String orbName{_desc.filesDescriptions[0].fileName};
+ const Common::String broName{_desc.filesDescriptions[1].fileName};
- if (strcmp(_desc.gameId, kPeril) == 0){
- _bro = new BroFile();
- }
- else debug("This game doesn't need to use bro");
+ if (strcmp(_desc.gameId, kPeril) == 0){
+ _bro = new BroFile();
+ }
+ else debug("This game doesn't need to use bro");
- if (!_orb.open(orbName) || (_bro && !_bro->open(broName, _orb.getTimestamp()))){
- return Common::kNoGameDataFoundError;
- }
+ if (!_orb.open(orbName) || (_bro && !_bro->open(broName, _orb.getTimestamp()))){
+ return Common::kNoGameDataFoundError;
+ }
- if (!loadCursors())
- return Common::kNoGameDataFoundError;
+ if (!loadCursors())
+ return Common::kNoGameDataFoundError;
- setCursor(kLoadingCursor);
- _system->showMouse(1);
+ setCursor(kLoadingCursor);
+ _system->showMouse(1);
- _orb.loadGame(this);
+ _orb.loadGame(this);
- initModule(_modules[0]->getName(), kLoadingNewGame, "");
+ initModule(_modules[0]->getName(), kLoadingNewGame, "");
- return Common::kNoError;
+ return Common::kNoError;
}
Common::Error Pink::PinkEngine::run() {
- Common::Error error = init();
- if (error.getCode() != Common::kNoError)
- return error;
-
- while(!shouldQuit()){
- Common::Event event;
- while(_eventMan->pollEvent(event)){
- switch (event.type){
- case Common::EVENT_QUIT:
- case Common::EVENT_RTL:
- return Common::kNoError;
- case Common::EVENT_MOUSEMOVE:
- _actor->onMouseMove(event.mouse);
- break;
- case Common::EVENT_LBUTTONDOWN:
- _actor->onLeftButtonClick(event.mouse);
- break;
- case Common::EVENT_KEYDOWN:
- if (event.kbd.keycode == Common::KEYCODE_d)
- _director.showBounds = !_director.showBounds;
- else _actor->onKeyboardButtonClick(event.kbd.keycode);
- 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(5);
- }
-
- return Common::kNoError;
+ Common::Error error = init();
+ if (error.getCode() != Common::kNoError)
+ return error;
+
+ while(!shouldQuit()){
+ Common::Event event;
+ while(_eventMan->pollEvent(event)){
+ switch (event.type){
+ case Common::EVENT_QUIT:
+ case Common::EVENT_RTL:
+ return Common::kNoError;
+ case Common::EVENT_MOUSEMOVE:
+ _actor->onMouseMove(event.mouse);
+ break;
+ case Common::EVENT_LBUTTONDOWN:
+ _actor->onLeftButtonClick(event.mouse);
+ break;
+ case Common::EVENT_KEYDOWN:
+ if (event.kbd.keycode == Common::KEYCODE_d)
+ _director.showBounds = !_director.showBounds;
+ else _actor->onKeyboardButtonClick(event.kbd.keycode);
+ 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(5);
+ }
+
+ return Common::kNoError;
}
void PinkEngine::load(Archive &archive) {
- archive.readString();
- archive.readString();
- _modules.deserialize(archive);
+ archive.readString();
+ archive.readString();
+ _modules.deserialize(archive);
}
void PinkEngine::initModule(const Common::String &moduleName, bool isLoadingFromSave, const Common::String &pageName) {
- if (_module) {
- for (uint i = 0; i < _modules.size(); ++i) {
- if (_module == _modules[i]){
- _modules[i] = new ModuleProxy(_module->getName());
-
- delete _module;
- _module = nullptr;
-
- break;
- }
- }
- }
-
- for (uint i = 0; i < _modules.size(); ++i) {
- if (_modules[i]->getName() == moduleName) {
- loadModule(i);
- _module = static_cast<Module*>(_modules[i]);
- _module->init(isLoadingFromSave, pageName);
- break;
- }
- }
+ if (_module) {
+ for (uint i = 0; i < _modules.size(); ++i) {
+ if (_module == _modules[i]){
+ _modules[i] = new ModuleProxy(_module->getName());
+
+ delete _module;
+ _module = nullptr;
+
+ break;
+ }
+ }
+ }
+
+ for (uint i = 0; i < _modules.size(); ++i) {
+ if (_modules[i]->getName() == moduleName) {
+ loadModule(i);
+ _module = static_cast<Module*>(_modules[i]);
+ _module->init(isLoadingFromSave, pageName);
+ break;
+ }
+ }
}
void PinkEngine::changeScene(GamePage *page) {
- setCursor(kLoadingCursor);
- if (!_nextModule.empty() && _nextModule.compareTo(_module->getName())) {
- initModule(_nextModule, kLoadingNewGame, _nextPage);
- }
- else {
- assert(!_nextPage.empty());
- _module->changePage(_nextPage);
- }
+ setCursor(kLoadingCursor);
+ if (!_nextModule.empty() && _nextModule.compareTo(_module->getName())) {
+ initModule(_nextModule, kLoadingNewGame, _nextPage);
+ }
+ else {
+ assert(!_nextPage.empty());
+ _module->changePage(_nextPage);
+ }
}
void PinkEngine::setNextExecutors(const Common::String &nextModule, const Common::String &nextPage) {
- _nextModule = nextModule;
- _nextPage = nextPage;
+ _nextModule = nextModule;
+ _nextPage = nextPage;
}
void PinkEngine::loadModule(int index) {
- Module *module = new Module(this, _modules[index]->getName());
+ Module *module = new Module(this, _modules[index]->getName());
- _orb.loadObject(module, module->getName());
+ _orb.loadObject(module, module->getName());
- delete _modules[index];
- _modules[index] = module;
+ delete _modules[index];
+ _modules[index] = module;
}
bool PinkEngine::checkValueOfVariable(Common::String &variable, Common::String &value) {
- if (!_variables.contains(variable))
- return value == kUndefined;
- return _variables[variable] == value;
+ if (!_variables.contains(variable))
+ return value == kUndefined;
+ return _variables[variable] == value;
}
void PinkEngine::setVariable(Common::String &variable, Common::String &value) {
- _variables[variable] = value;
+ _variables[variable] = value;
}
bool PinkEngine::loadCursors() {
- Common::PEResources exeResources;
- bool isPokus = !strcmp(_desc.gameId, kPokus);
- Common::String fileName = isPokus ? _desc.filesDescriptions[1].fileName : _desc.filesDescriptions[2].fileName;
- if (!exeResources.loadFromEXE(fileName))
- return false;
-
- _cursors.reserve(kCursorsCount);
-
- _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusLoadingCursorID));
- _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusExitForwardCursorID));
- _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusExitLeftCursorID));
- _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusExitRightCursorID));
- _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusClickableFirstCursorID));
- _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusClickableSecondCursorID));
-
- if (isPokus) {
- _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusClickableThirdCursorID));
- _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusNotClickableCursorID));
- _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusHoldingItemCursorID));
- }
- else {
- _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPerilClickableThirdCursorID));
- _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPerilNotClickableCursorID));
- _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPerilHoldingItemCursorID));
- }
-
- _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusPDAFirstCursorID));
-
- if (isPokus)
- _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusPDASecondCursorID));
- else
- _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPerilPDASecondCursorID));
-
- return true;
+ Common::PEResources exeResources;
+ bool isPokus = !strcmp(_desc.gameId, kPokus);
+ Common::String fileName = isPokus ? _desc.filesDescriptions[1].fileName : _desc.filesDescriptions[2].fileName;
+ if (!exeResources.loadFromEXE(fileName))
+ return false;
+
+ _cursors.reserve(kCursorsCount);
+
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusLoadingCursorID));
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusExitForwardCursorID));
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusExitLeftCursorID));
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusExitRightCursorID));
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusClickableFirstCursorID));
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusClickableSecondCursorID));
+
+ if (isPokus) {
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusClickableThirdCursorID));
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusNotClickableCursorID));
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusHoldingItemCursorID));
+ }
+ else {
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPerilClickableThirdCursorID));
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPerilNotClickableCursorID));
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPerilHoldingItemCursorID));
+ }
+
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusPDAFirstCursorID));
+
+ if (isPokus)
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPokusPDASecondCursorID));
+ else
+ _cursors.push_back(Graphics::WinCursorGroup::createCursorGroup(exeResources, kPerilPDASecondCursorID));
+
+ return true;
}
void PinkEngine::setCursor(uint cursorIndex) {
- Graphics::Cursor *cursor = _cursors[cursorIndex]->cursors[0].cursor;
- _system->setCursorPalette(cursor->getPalette(), cursor->getPaletteStartIndex(), cursor->getPaletteCount());
- _system->setMouseCursor(cursor->getSurface(), cursor->getWidth(), cursor->getHeight(),
- cursor->getHotspotX(), cursor->getHotspotY(), cursor->getKeyColor());
+ Graphics::Cursor *cursor = _cursors[cursorIndex]->cursors[0].cursor;
+ _system->setCursorPalette(cursor->getPalette(), cursor->getPaletteStartIndex(), cursor->getPaletteCount());
+ _system->setMouseCursor(cursor->getSurface(), cursor->getWidth(), cursor->getHeight(),
+ cursor->getHotspotX(), cursor->getHotspotY(), cursor->getKeyColor());
}
}
diff --git a/engines/pink/pink.h b/engines/pink/pink.h
index 710f590d34..98d962e34a 100644
--- a/engines/pink/pink.h
+++ b/engines/pink/pink.h
@@ -73,61 +73,61 @@ class GamePage;
class LeadActor;
enum {
- kPinkDebugGeneral = 1 << 0,
- kPinkDebugLoadingResources = 1 << 1,
- kPinkDebugLoadingObjects = 1 << 2,
- kPinkDebugGraphics = 1 << 3,
- kPinkDebugSound = 1 << 4
+ kPinkDebugGeneral = 1 << 0,
+ kPinkDebugLoadingResources = 1 << 1,
+ kPinkDebugLoadingObjects = 1 << 2,
+ kPinkDebugGraphics = 1 << 3,
+ kPinkDebugSound = 1 << 4
};
class PinkEngine : public Engine {
public:
- PinkEngine(OSystem *system, const ADGameDescription *desc);
- ~PinkEngine();
+ PinkEngine(OSystem *system, const ADGameDescription *desc);
+ ~PinkEngine();
- virtual Common::Error run();
+ virtual Common::Error run();
- void load(Archive &archive);
- void initModule(const Common::String &moduleName, bool isLoadingFromSave, const Common::String &pageName);
- void changeScene(GamePage *page);
+ 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() { return _rnd; };
- Director *getDirector() { return &_director; }
+ OrbFile *getOrb() { return &_orb; }
+ BroFile *getBro() { return _bro; }
+ 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; };
- void setCursor(uint cursorIndex);
+ void setNextExecutors(const Common::String &nextModule, const Common::String &nextPage);
+ void setLeadActor(LeadActor *actor) { _actor = actor; };
+ void setCursor(uint cursorIndex);
- void setVariable(Common::String &variable, Common::String &value);
- 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();
- bool loadCursors();
+ Common::Error init();
+ bool loadCursors();
- void loadModule(int index);
+ void loadModule(int index);
- Console *_console;
- Common::RandomSource _rnd;
- Common::Array<Graphics::WinCursorGroup*> _cursors;
+ Console *_console;
+ Common::RandomSource _rnd;
+ Common::Array<Graphics::WinCursorGroup*> _cursors;
- Common::String _nextModule;
- Common::String _nextPage;
+ Common::String _nextModule;
+ Common::String _nextPage;
- OrbFile _orb;
- BroFile *_bro;
+ OrbFile _orb;
+ BroFile *_bro;
- Director _director;
- LeadActor *_actor;
+ Director _director;
+ LeadActor *_actor;
- Module *_module;
- Array<NamedObject*> _modules;
+ Module *_module;
+ Array<NamedObject*> _modules;
- Common::StringMap _variables;
+ Common::StringMap _variables;
- const ADGameDescription _desc;
+ const ADGameDescription _desc;
};
} // End of namespace Pink
diff --git a/engines/pink/resource_mgr.cpp b/engines/pink/resource_mgr.cpp
index 9c72fc7b92..fbba3828db 100644
--- a/engines/pink/resource_mgr.cpp
+++ b/engines/pink/resource_mgr.cpp
@@ -32,59 +32,59 @@
namespace Pink {
ResourceMgr::ResourceMgr()
- : _game(nullptr), _resDescTable(nullptr),
- _resCount(0) {}
+ : _game(nullptr), _resDescTable(nullptr),
+ _resCount(0) {}
ResourceMgr::~ResourceMgr() {
- clear();
+ clear();
}
void ResourceMgr::init(PinkEngine *game, GamePage *page) {
- OrbFile *orb = game->getOrb();
- _game = game;
+ OrbFile *orb = game->getOrb();
+ _game = game;
- ObjectDescription *objDesc = orb->getObjDesc(page->getName().c_str());
- _resCount = objDesc->resourcesCount;
- orb->loadObject(page, objDesc);
- _resDescTable = orb->getResDescTable(objDesc);
+ ObjectDescription *objDesc = orb->getObjDesc(page->getName().c_str());
+ _resCount = objDesc->resourcesCount;
+ orb->loadObject(page, objDesc);
+ _resDescTable = orb->getResDescTable(objDesc);
}
Sound *ResourceMgr::loadSound(Common::String &name) {
- return new Sound(_game->_mixer, getResourceStream(name));
+ return new Sound(_game->_mixer, getResourceStream(name));
}
Common::SafeSeekableSubReadStream *ResourceMgr::getResourceStream(Common::String &name) {
- Common::SeekableReadStream *stream;
+ Common::SeekableReadStream *stream;
- ResourceDescription &desc = _resDescTable[0];
+ ResourceDescription &desc = _resDescTable[0];
for (uint i = 0; i < _resCount; ++i) {
if (name.compareToIgnoreCase(_resDescTable[i].name) == 0)
desc = _resDescTable[i];
}
- if (desc.inBro)
- stream = _game->getBro();
- else stream = _game->getOrb();
+ if (desc.inBro)
+ stream = _game->getBro();
+ else stream = _game->getOrb();
- stream->seek(desc.offset);
+ stream->seek(desc.offset);
- return new Common::SafeSeekableSubReadStream(stream, desc.offset,
- desc.offset + desc.size);
+ return new Common::SafeSeekableSubReadStream(stream, desc.offset,
+ desc.offset + desc.size);
}
PinkEngine *ResourceMgr::getGame() const {
- return _game;
+ return _game;
}
CelDecoder *ResourceMgr::loadCEL(Common::String &name) {
- CelDecoder *decoder = new CelDecoder();
- decoder->loadStream(getResourceStream(name));
- return decoder;
+ CelDecoder *decoder = new CelDecoder();
+ decoder->loadStream(getResourceStream(name));
+ return decoder;
}
void ResourceMgr::clear() {
- delete[] _resDescTable;
- _resDescTable = nullptr;
+ delete[] _resDescTable;
+ _resDescTable = nullptr;
}
} // End of namespace Pink
diff --git a/engines/pink/resource_mgr.h b/engines/pink/resource_mgr.h
index 4cef65198d..0b06e998da 100644
--- a/engines/pink/resource_mgr.h
+++ b/engines/pink/resource_mgr.h
@@ -25,7 +25,7 @@
namespace Common {
class SafeSeekableSubReadStream;
- class String;
+ class String;
}
namespace Pink {
@@ -41,23 +41,23 @@ struct ResourceDescription;
class ResourceMgr {
public:
- ResourceMgr();
- ~ResourceMgr();
+ ResourceMgr();
+ ~ResourceMgr();
- void init(PinkEngine *game, GamePage *page);
- void clear();
+ void init(PinkEngine *game, GamePage *page);
+ void clear();
- //Common::String loadText(Common::String &name);
- Sound *loadSound(Common::String &name);
- CelDecoder *loadCEL(Common::String &name);
- PinkEngine *getGame() const;
+ //Common::String loadText(Common::String &name);
+ Sound *loadSound(Common::String &name);
+ CelDecoder *loadCEL(Common::String &name);
+ PinkEngine *getGame() const;
private:
- Common::SafeSeekableSubReadStream *getResourceStream(Common::String &name);
+ Common::SafeSeekableSubReadStream *getResourceStream(Common::String &name);
- PinkEngine *_game;
- ResourceDescription *_resDescTable;
- uint32 _resCount;
+ PinkEngine *_game;
+ ResourceDescription *_resDescTable;
+ uint32 _resCount;
};
} // End of namespace Pink
diff --git a/engines/pink/sound.cpp b/engines/pink/sound.cpp
index b4b8f2a2e8..db6ff8c442 100644
--- a/engines/pink/sound.cpp
+++ b/engines/pink/sound.cpp
@@ -31,54 +31,54 @@
namespace Pink {
Sound::Sound(Audio::Mixer *mixer, Common::SafeSeekableSubReadStream *stream)
- : _mixer(mixer), _fileStream(stream)
+ : _mixer(mixer), _fileStream(stream)
{
}
Sound::~Sound() {
- stop();
- delete _fileStream;
+ stop();
+ delete _fileStream;
}
bool Sound::isPlaying() {
- return _mixer->isSoundHandleActive(_handle);
+ return _mixer->isSoundHandleActive(_handle);
}
void Sound::pause() {
- _mixer->pauseHandle(_handle, true);
+ _mixer->pauseHandle(_handle, true);
}
void Sound::resume() {
- _mixer->pauseHandle(_handle, false);
+ _mixer->pauseHandle(_handle, false);
}
void Sound::stop() {
- _mixer->stopHandle(_handle);
+ _mixer->stopHandle(_handle);
}
void Sound::play(Audio::Mixer::SoundType type, int volume, bool isLoop) {
- // Vox files in pink have wave format.
- // RIFF (little-endian) data, WAVE audio, Microsoft PCM, 8 bit, mono 22050 Hz
- _mixer->stopHandle(_handle);
-
- _fileStream->seek(0);
- Audio::AudioStream *audioStream ;
- Audio::SeekableAudioStream *wavStream = Audio::makeWAVStream(_fileStream, DisposeAfterUse::NO);
- if (isLoop) {
- audioStream = Audio::makeLoopingAudioStream(wavStream, 0, 0, 0);
- }
- else audioStream = wavStream;
-
- _mixer->playStream(type, &_handle , audioStream, -1 , 50, 0, DisposeAfterUse::YES);
+ // Vox files in pink have wave format.
+ // RIFF (little-endian) data, WAVE audio, Microsoft PCM, 8 bit, mono 22050 Hz
+ _mixer->stopHandle(_handle);
+
+ _fileStream->seek(0);
+ Audio::AudioStream *audioStream ;
+ Audio::SeekableAudioStream *wavStream = Audio::makeWAVStream(_fileStream, DisposeAfterUse::NO);
+ if (isLoop) {
+ audioStream = Audio::makeLoopingAudioStream(wavStream, 0, 0, 0);
+ }
+ else audioStream = wavStream;
+
+ _mixer->playStream(type, &_handle , audioStream, -1 , 50, 0, DisposeAfterUse::YES);
}
void Sound::setBalance(int8 balance) {
- _mixer->setChannelBalance(_handle, balance);
+ _mixer->setChannelBalance(_handle, balance);
}
uint32 Sound::getCurrentSample() {
- return _mixer->getSoundElapsedTime(_handle) * kSampleRate / 1000;
+ return _mixer->getSoundElapsedTime(_handle) * kSampleRate / 1000;
}
} // End of namespace Pink
diff --git a/engines/pink/sound.h b/engines/pink/sound.h
index f6207f49e9..9d7007419f 100644
--- a/engines/pink/sound.h
+++ b/engines/pink/sound.h
@@ -38,24 +38,24 @@ namespace Pink {
class Sound {
public:
- Sound(Audio::Mixer *mixer, Common::SafeSeekableSubReadStream *stream);
- ~Sound();
+ Sound(Audio::Mixer *mixer, Common::SafeSeekableSubReadStream *stream);
+ ~Sound();
- void play(Audio::Mixer::SoundType type, int volume, bool isLoop);
+ void play(Audio::Mixer::SoundType type, int volume, bool isLoop);
- bool isPlaying();
+ bool isPlaying();
- void pause();
- void resume();
- void stop();
+ void pause();
+ void resume();
+ void stop();
- uint32 getCurrentSample();
- void setBalance(int8 balance);
+ uint32 getCurrentSample();
+ void setBalance(int8 balance);
private:
- Audio::Mixer *_mixer;
- Audio::SoundHandle _handle;
- Common::SafeSeekableSubReadStream *_fileStream;
+ Audio::Mixer *_mixer;
+ Audio::SoundHandle _handle;
+ Common::SafeSeekableSubReadStream *_fileStream;
};
} // End of namespace Pink