diff options
author | whitertandrek | 2018-03-18 13:34:49 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2018-06-28 23:51:32 +0200 |
commit | 198710adac6c827a9db4b0640952d8ea88713ca2 (patch) | |
tree | 8c0f3d8a40748e6596940d1d9e3f10c191f825b3 | |
parent | 0f8768c5ade1a211ee0afbc61c3f33ce236588dc (diff) | |
download | scummvm-rg350-198710adac6c827a9db4b0640952d8ea88713ca2.tar.gz scummvm-rg350-198710adac6c827a9db4b0640952d8ea88713ca2.tar.bz2 scummvm-rg350-198710adac6c827a9db4b0640952d8ea88713ca2.zip |
PINK: Implemented Page loading.
37 files changed, 928 insertions, 50 deletions
diff --git a/engines/pink/actions/action.cpp b/engines/pink/actions/action.cpp new file mode 100644 index 0000000000..dfeed6f2c7 --- /dev/null +++ b/engines/pink/actions/action.cpp @@ -0,0 +1,34 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "action.h" +#include "../actors/actor.h" +#include "../archive.h" + +namespace Pink { + +void Action::deserialize(Archive &archive) { + NamedObject::deserialize(archive); + _actor = static_cast<Actor*>(archive.readObject()); +} + +} // End of namespace Pink diff --git a/engines/pink/actions/action.h b/engines/pink/actions/action.h new file mode 100644 index 0000000000..3d7130309d --- /dev/null +++ b/engines/pink/actions/action.h @@ -0,0 +1,42 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef PINK_ACTION_H +#define PINK_ACTION_H + +#include "../object.h" + +namespace Pink { + +class Actor; + +class Action : public NamedObject { +public: + virtual void deserialize(Archive &archive); + +private: + Actor *_actor; +}; + +} // End of namespace Pink + +#endif diff --git a/engines/pink/actions/action_cel.cpp b/engines/pink/actions/action_cel.cpp new file mode 100644 index 0000000000..a84ea41932 --- /dev/null +++ b/engines/pink/actions/action_cel.cpp @@ -0,0 +1,33 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "action_cel.h" +#include "../archive.h" + +namespace Pink { + +void ActionCEL::deserialize(Archive &archive) { + Action::deserialize(archive); + archive >> _fileName >> _z; +} + +} // End of namespace Pink
\ No newline at end of file diff --git a/engines/pink/actions/action_cel.h b/engines/pink/actions/action_cel.h new file mode 100644 index 0000000000..346b9d21d6 --- /dev/null +++ b/engines/pink/actions/action_cel.h @@ -0,0 +1,41 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef PINK_ACTION_CEL_H +#define PINK_ACTION_CEL_H + +#include "action.h" + +namespace Pink { + +class ActionCEL : public Action { +public: + virtual void deserialize(Archive &archive); + +private: + Common::String _fileName; + uint32 _z; // Z coordinate for sprite +}; + +} // End of namespace Pink + +#endif diff --git a/engines/pink/objects/actor.cpp b/engines/pink/actions/action_hide.cpp index c90afb7901..8c3eb17bef 100644 --- a/engines/pink/objects/actor.cpp +++ b/engines/pink/actions/action_hide.cpp @@ -23,5 +23,4 @@ namespace Pink { - -} // End of namespace Pink +} //End of namespace Pink
\ No newline at end of file diff --git a/engines/pink/actions/action_hide.h b/engines/pink/actions/action_hide.h new file mode 100644 index 0000000000..2c2af5c2c6 --- /dev/null +++ b/engines/pink/actions/action_hide.h @@ -0,0 +1,36 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef PINK_ACTION_HIDE_H +#define PINK_ACTION_HIDE_H + +#include "action.h" + +namespace Pink { + +class ActionHide : public Action { + +}; + +} //End of namespace Pink + +#endif diff --git a/engines/pink/actions/action_play.cpp b/engines/pink/actions/action_play.cpp new file mode 100644 index 0000000000..d31775db1a --- /dev/null +++ b/engines/pink/actions/action_play.cpp @@ -0,0 +1,33 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "action_play.h" +#include "../archive.h" + +namespace Pink { + +void ActionPlay::deserialize(Archive &archive) { + ActionStill::deserialize(archive); + archive >> _stopFrame; +} + +} // End of namespace Pink diff --git a/engines/pink/actions/action_play.h b/engines/pink/actions/action_play.h new file mode 100644 index 0000000000..00360d9fc0 --- /dev/null +++ b/engines/pink/actions/action_play.h @@ -0,0 +1,40 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef PINK_ACTION_PLAY_H +#define PINK_ACTION_PLAY_H + +#include "action.h" +#include "action_still.h" + +namespace Pink { + +class ActionPlay : public ActionStill { + virtual void deserialize(Archive &archive); + +private: + uint32 _stopFrame; +}; + +} // End of namespace Pink + +#endif diff --git a/engines/pink/actions/action_sound.cpp b/engines/pink/actions/action_sound.cpp new file mode 100644 index 0000000000..b5e5c5e9e4 --- /dev/null +++ b/engines/pink/actions/action_sound.cpp @@ -0,0 +1,36 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "action_sound.h" +#include "../archive.h" + +namespace Pink { + +void ActionSound::deserialize(Archive &archive) { + Action::deserialize(archive); + archive >> _fileName; + _volume = archive.readDWORD(); + _isLoop = (bool) archive.readDWORD(); + _isBackground = (bool) archive.readDWORD(); +} + +} // End of namespace Pink
\ No newline at end of file diff --git a/engines/pink/actions/action_sound.h b/engines/pink/actions/action_sound.h new file mode 100644 index 0000000000..15b27d795b --- /dev/null +++ b/engines/pink/actions/action_sound.h @@ -0,0 +1,47 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef PINK_ACTION_SOUND_H +#define PINK_ACTION_SOUND_H + +#include "action.h" + +namespace Pink { + +class Sound; + +class ActionSound : public Action { +public: + virtual void deserialize(Archive &archive); + +private: + Sound *_sound; + Common::String _fileName; + uint32 _volume; + bool _isLoop; + bool _isBackground; + bool _isStopped; +}; + +} // End of namespace Pink + +#endif diff --git a/engines/pink/actions/action_still.cpp b/engines/pink/actions/action_still.cpp new file mode 100644 index 0000000000..f015a8b692 --- /dev/null +++ b/engines/pink/actions/action_still.cpp @@ -0,0 +1,33 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "action_still.h" +#include "../archive.h" + +namespace Pink { + +void ActionStill::deserialize(Archive &archive) { + ActionCEL::deserialize(archive); + archive >> _startFrame; +} + +} // End of namespace Pink
\ No newline at end of file diff --git a/engines/pink/actions/action_still.h b/engines/pink/actions/action_still.h new file mode 100644 index 0000000000..9d6c7be9d0 --- /dev/null +++ b/engines/pink/actions/action_still.h @@ -0,0 +1,40 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef PINK_ACTION_STILL_H +#define PINK_ACTION_STILL_H + +#include "action_cel.h" + +namespace Pink { + +class ActionStill : public ActionCEL { +public: + virtual void deserialize(Archive &archive); + +private: + uint32 _startFrame; +}; + +} // End of namespace Pink + +#endif diff --git a/engines/pink/actors/actor.cpp b/engines/pink/actors/actor.cpp new file mode 100644 index 0000000000..30f7e7b12f --- /dev/null +++ b/engines/pink/actors/actor.cpp @@ -0,0 +1,34 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "actor.h" +#include "../page.h" + +namespace Pink { + +void Actor::deserialize(Archive &archive) { + NamedObject::deserialize(archive); + _page = static_cast<GamePage*>(archive.readObject()); + archive >> _actions; +} + +} // End of namespace Pink diff --git a/engines/pink/actors/actor.h b/engines/pink/actors/actor.h new file mode 100644 index 0000000000..8daccc88b9 --- /dev/null +++ b/engines/pink/actors/actor.h @@ -0,0 +1,48 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef PINK_ACTOR_H +#define PINK_ACTOR_H + +#include <common/array.h> +#include "../object.h" + +namespace Pink { + +class GamePage; +class Action; + +class Actor : public NamedObject { +public: + Actor() {}; + virtual void deserialize(Archive &archive); + +private: + GamePage *_page; + //int possibly_isActionNotExist; + Action *_action; + Common::Array<Action*> _actions; +}; + +} // End of namespace Pink + +#endif diff --git a/engines/pink/actors/lead_actor.cpp b/engines/pink/actors/lead_actor.cpp new file mode 100644 index 0000000000..308e6413b9 --- /dev/null +++ b/engines/pink/actors/lead_actor.cpp @@ -0,0 +1,38 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "lead_actor.h" +#include "../walk/walk_mgr.h" +#include "../cursor_mgr.h" +#include "../sequencer.h" +#include "../archive.h" + +namespace Pink { + +void LeadActor::deserialize(Archive &archive) { + Actor::deserialize(archive); + _cursorMgr = static_cast<CursorMgr*>(archive.readObject()); + _walkMgr = static_cast<WalkMgr*>(archive.readObject()); + _sequencer = static_cast<Sequencer*>(archive.readObject()); +} + +} // End of namespace Pink diff --git a/engines/pink/actors/lead_actor.h b/engines/pink/actors/lead_actor.h new file mode 100644 index 0000000000..a859de8fd5 --- /dev/null +++ b/engines/pink/actors/lead_actor.h @@ -0,0 +1,46 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef PINK_LEAD_ACTOR_H +#define PINK_LEAD_ACTOR_H + +#include "actor.h" + +namespace Pink { + +class CursorMgr; +class WalkMgr; +class Sequencer; + +class LeadActor : public Actor { +public: + virtual void deserialize(Archive &archive); + +private: + CursorMgr *_cursorMgr; + WalkMgr *_walkMgr; + Sequencer *_sequencer; +}; + +} // End of namespace Pink + +#endif diff --git a/engines/pink/archive.cpp b/engines/pink/archive.cpp index 4627800b51..265c9c6348 100644 --- a/engines/pink/archive.cpp +++ b/engines/pink/archive.cpp @@ -22,8 +22,14 @@ #include <common/debug.h> #include <common/file.h> -#include "objects/module.h" -#include "objects/page.h" +#include <engines/pink/actors/actor.h> +#include <engines/pink/walk/walk_location.h> +#include <engines/pink/actions/action_hide.h> +#include <engines/pink/actions/action_play.h> +#include <engines/pink/actions/action_sound.h> +#include "module.h" +#include "page.h" +#include "actors/lead_actor.h" namespace Pink { @@ -140,12 +146,26 @@ static const struct RuntimeClass { static Object* createObject(int objectId){ switch (objectId){ + case kActionHide: + return new ActionHide; + case kActionPlay: + return new ActionPlay; + case kActionSound: + return new ActionSound; + case kActionStill: + return new ActionStill; + case kActor: + return new Actor; case kGamePage: return new GamePage; case kInventoryItem: return new InventoryItem; + case kLeadActor: + return new LeadActor; case kModuleProxy: return new ModuleProxy; + case kWalkLocation: + return new WalkLocation; default: return nullptr; } @@ -165,7 +185,7 @@ Archive::~Archive() } void Archive::mapObject(Object *obj) { - _objectMap.push_back(obj); // Basically a hack, but behavior is all correct + _objectMap.push_back(obj); _objectIdMap.push_back(0); } @@ -207,11 +227,13 @@ Object *Archive::parseObject(bool &isCopyReturned) { objectId = findObjectId(className + 1); res = createObject(objectId); + if (!res) error("Class %s is not implemented", className); + _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) { @@ -254,6 +276,10 @@ Common::String Archive::readString() { return Common::String(buffer, len); } +uint32 Archive::readDWORD() { + return _file.readUint32LE(); +} + } // End of namespace Pink diff --git a/engines/pink/archive.h b/engines/pink/archive.h index 6971b0f1bb..9ca1c29951 100644 --- a/engines/pink/archive.h +++ b/engines/pink/archive.h @@ -24,7 +24,7 @@ #define PINK_ARCHIVE_H #include <common/array.h> -#include <engines/pink/objects/object.h> +#include <engines/pink/object.h> namespace Common { @@ -40,10 +40,13 @@ public: ~Archive(); void mapObject(Object *obj); + int readCount(); + uint32 readDWORD(); Object *readObject(); Common::String readString(); + private: uint findObjectId(const char *name); @@ -75,6 +78,12 @@ inline Archive &operator>>(Archive &archive, Common::String &string){ return archive; } +inline Archive &operator>>(Archive &archive, uint32 &num){ + num = archive.readDWORD(); + return archive; +} + + } // End of namespace Pink #endif diff --git a/engines/pink/cursor_mgr.cpp b/engines/pink/cursor_mgr.cpp new file mode 100644 index 0000000000..90cbd904d5 --- /dev/null +++ b/engines/pink/cursor_mgr.cpp @@ -0,0 +1,29 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "cursor_mgr.h" + +namespace Pink { + +CursorMgr::CursorMgr(GamePage *page) : page(page) {} + +} // End of namespace Pink
\ No newline at end of file diff --git a/engines/pink/objects/actor.h b/engines/pink/cursor_mgr.h index a9c0ff8844..cfc16ac930 100644 --- a/engines/pink/objects/actor.h +++ b/engines/pink/cursor_mgr.h @@ -20,21 +20,23 @@ * */ -#ifndef PINK_ACTOR_H -#define PINK_ACTOR_H +#ifndef PINK_CURSOR_MGR_H +#define PINK_CURSOR_MGR_H + +#include "engines/pink/object.h" namespace Pink { +class Actor; class GamePage; -class Actor { +class CursorMgr : public Object { public: + CursorMgr(GamePage *page); private: + Actor *actor; GamePage *page; - //int possibly_isActionNotExist; - //CAction *action; - //CObArray actions; }; } // End of namespace Pink diff --git a/engines/pink/file.cpp b/engines/pink/file.cpp index 38df98dec6..354c7b5ae7 100644 --- a/engines/pink/file.cpp +++ b/engines/pink/file.cpp @@ -21,7 +21,7 @@ */ #include <common/str.h> -#include "objects/page.h" +#include "page.h" #include "pink.h" namespace Pink { diff --git a/engines/pink/objects/inventory.cpp b/engines/pink/inventory.cpp index 7a606e93a4..ed2569e7c1 100644 --- a/engines/pink/objects/inventory.cpp +++ b/engines/pink/inventory.cpp @@ -22,6 +22,7 @@ #include "inventory.h" +#include "archive.h" namespace Pink { @@ -32,7 +33,7 @@ void Pink::InventoryItem::deserialize(Archive &archive) { } InventoryMgr::~InventoryMgr() { - for (int i = 0; i < _invItems.size(); ++i) { + for (uint i = 0; i < _invItems.size(); ++i) { delete _invItems[i]; } } diff --git a/engines/pink/objects/inventory.h b/engines/pink/inventory.h index 6dacd8743c..197c226e5d 100644 --- a/engines/pink/objects/inventory.h +++ b/engines/pink/inventory.h @@ -23,7 +23,9 @@ #ifndef PINK_INVENTORY_H #define PINK_INVENTORY_H -#include "named_object.h" + +#include <common/array.h> +#include "engines/pink/object.h" namespace Pink { diff --git a/engines/pink/objects/module.cpp b/engines/pink/module.cpp index 505b8fba11..4b5d1363d3 100644 --- a/engines/pink/objects/module.cpp +++ b/engines/pink/module.cpp @@ -91,6 +91,10 @@ void Module::init(bool isLoadingSave, const Common::String *pageName) { assert(0); } +PinkEngine *Module::getGame() const { + return _game; +} + } // End of namespace Pink diff --git a/engines/pink/objects/module.h b/engines/pink/module.h index ea2eceef7d..1ec10bf988 100644 --- a/engines/pink/objects/module.h +++ b/engines/pink/module.h @@ -23,10 +23,9 @@ #ifndef PINK_MODULE_H #define PINK_MODULE_H -#include "../archive.h" +#include "archive.h" #include <common/str.h> -#include "object.h" -#include "named_object.h" +#include "engines/pink/object.h" #include <common/debug.h> #include <engines/pink/utils.h> #include <common/hash-str.h> @@ -55,6 +54,10 @@ public: private: PinkEngine *_game; +public: + PinkEngine *getGame() const; + +private: GamePage *_page; PagesArray _pages; InventoryMgr _invMgr; diff --git a/engines/pink/module.mk b/engines/pink/module.mk index a29b18acfa..b78f3f16f3 100644 --- a/engines/pink/module.mk +++ b/engines/pink/module.mk @@ -8,8 +8,14 @@ MODULE_OBJS = \ sound.o \ file.o \ archive.o \ - objects/object.o \ - objects/module.o \ + object.o \ + module.o \ + page.o \ + inventory.o \ + resource_mgr.o \ + actions/action.o \ + actors/actor.o \ + actors/lead_actor.o \ # This module can be built as a plugin diff --git a/engines/pink/object.cpp b/engines/pink/object.cpp new file mode 100644 index 0000000000..5e99bd7c7a --- /dev/null +++ b/engines/pink/object.cpp @@ -0,0 +1,45 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "object.h" +#include "archive.h" + +namespace Pink { + +Pink::NamedObject::NamedObject(const Common::String &name) + : _name(name) +{} + +void Pink::NamedObject::deserialize(Archive &archive) { + _name = archive.readString(); +} + +const Common::String &Pink::NamedObject::getName() const { + return _name; +} + +void NamedObject::store(Archive &archive) { + +} + +} // End of namespace Pink + diff --git a/engines/pink/objects/object.h b/engines/pink/object.h index f6e1ee79d9..f8abf4e9b9 100644 --- a/engines/pink/objects/object.h +++ b/engines/pink/object.h @@ -23,6 +23,8 @@ #ifndef PINK_OBJECT_H #define PINK_OBJECT_H +#include <common/str.h> + namespace Pink { class Archive; @@ -36,6 +38,20 @@ public: virtual void init() {} }; +class NamedObject : public Object { +public: + NamedObject(){}; + NamedObject(const Common::String &name); + + void deserialize(Archive &archive); + void store(Archive &archive); + + const Common::String &getName() const; + +private: + Common::String _name; +}; + } // End of namespace Pink #endif
\ No newline at end of file diff --git a/engines/pink/objects/page.cpp b/engines/pink/page.cpp index 31bb48b40c..3b769a427f 100644 --- a/engines/pink/objects/page.cpp +++ b/engines/pink/page.cpp @@ -20,7 +20,11 @@ * */ +#include <engines/pink/walk/walk_mgr.h> #include "page.h" +#include "cursor_mgr.h" +#include "actors/lead_actor.h" +#include "sequencer.h" namespace Pink { @@ -28,7 +32,7 @@ void Page::load(Archive &archive) { archive.mapObject(this); NamedObject::deserialize(archive); archive.readString(); //skip directory - // deserialize actors + archive >> _actors; } void GamePage::deserialize(Archive &archive) { @@ -38,21 +42,37 @@ void GamePage::deserialize(Archive &archive) { } void GamePage::load(Archive &archive) { - //archive.mapObject(_cursorMgr); - //archive.mapObject(_walkMgr); - //archive.mapObject(_sequencer); - //_leadActor = archive.readObject() - //serialize ccursormgr NullSub - //serialize walkmgr - //serialize sequencer + archive.mapObject(_cursorMgr); + archive.mapObject(_walkMgr); + archive.mapObject(_sequencer); + + Page::load(archive); + + _leadActor = static_cast<LeadActor*>(archive.readObject()); + + _walkMgr->deserialize(archive); + + _sequencer->deserialize(archive); //serialize handlers } void GamePage::init(bool isLoadingSave) { - if (isLoadingSave){ - assert(perhapsIsLoaded == 0); - // loadSerialize + if (!isLoadingSave){ + //assert(perhapsIsLoaded == 0); + loadFields(); } } +void GamePage::loadFields() { + perhapsIsLoaded = true; + _cursorMgr = new CursorMgr(this); + _walkMgr = new WalkMgr; + _sequencer = new Sequencer(this); + + _resMgr.init(_module->getGame(), this); + + // memfile manipulations + +} + } // End of namespace Pink diff --git a/engines/pink/objects/page.h b/engines/pink/page.h index f2ef83cc6b..5ea05bcd99 100644 --- a/engines/pink/objects/page.h +++ b/engines/pink/page.h @@ -23,48 +23,57 @@ #ifndef PINK_PAGE_H #define PINK_PAGE_H -#include "object.h" -#include "module.h" +#include "engines/pink/object.h" +#include "engines/pink/module.h" +#include "resource_mgr.h" namespace Pink { class Archive; +class Actor; +class LeadActor; + class Page : public NamedObject { public: void load(Archive &archive); -private: +protected: + ResourceMgr _resMgr; + LeadActor *_leadActor; + Common::Array<Actor*> _actors; + /* - * - * CLeadActor *_leadActor; int unk_1; - CObArray actors; CString _str; - PageResources *_ResourseMgr; */ }; + +class CursorMgr; +class WalkMgr; +class Sequencer; + class GamePage : public Page { public: - void deserialize(Archive &archive); + virtual void deserialize(Archive &archive); + virtual void load(Archive &archive); + void loadFields();; - void load(Archive &archive); + void init(bool isLoadingSave); - void init(bool isLoadingSave); private: int perhapsIsLoaded; Module *_module; + CursorMgr *_cursorMgr; + WalkMgr *_walkMgr; + Sequencer *_sequencer; /* int perhaps_notLoaded; int cunk_1; int memfile; - CModule *_module; - CCursorMgr *cursor_mgr; - CWalkMgr *walkMgr; - CSequencer *sequencer; CMapStringToString map; CObArray handlers; int unk; diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp index 4df3dfe8b7..9f286814d0 100644 --- a/engines/pink/pink.cpp +++ b/engines/pink/pink.cpp @@ -24,7 +24,7 @@ #include "console.h" #include <engines/util.h> #include <common/debug-channels.h> -#include "objects/module.h" +#include "module.h" namespace Pink { diff --git a/engines/pink/pink.h b/engines/pink/pink.h index 4aa691831e..834f787e21 100644 --- a/engines/pink/pink.h +++ b/engines/pink/pink.h @@ -23,7 +23,6 @@ #ifndef PINK_PINK_H #define PINK_PINK_H -#include <engines/pink/objects/named_object.h> #include "common/random.h" #include "engines/engine.h" #include "gui/EventRecorder.h" diff --git a/engines/pink/resource_mgr.cpp b/engines/pink/resource_mgr.cpp index 6676b0f9bf..dc53cf3a9d 100644 --- a/engines/pink/resource_mgr.cpp +++ b/engines/pink/resource_mgr.cpp @@ -23,7 +23,7 @@ #include "resource_mgr.h" #include "file.h" #include "pink.h" -#include "objects/page.h" +#include "page.h" namespace Pink { diff --git a/engines/pink/walk/walk_location.cpp b/engines/pink/walk/walk_location.cpp new file mode 100644 index 0000000000..239c69faba --- /dev/null +++ b/engines/pink/walk/walk_location.cpp @@ -0,0 +1,31 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "walk_location.h" +#include "../archive.h" + +void Pink::WalkLocation::deserialize(Pink::Archive &archive) { + NamedObject::deserialize(archive); + // serialize string array + //intro has zero, so skip + assert(archive.readCount() == 0); +} diff --git a/engines/pink/walk/walk_location.h b/engines/pink/walk/walk_location.h new file mode 100644 index 0000000000..0ad5adf055 --- /dev/null +++ b/engines/pink/walk/walk_location.h @@ -0,0 +1,41 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ +#ifndef PINK_WALK_LOCATION_H +#define PINK_WALK_LOCATION_H + +#include <engines/pink/object.h> +#include <common/array.h> + +namespace Pink { + +class WalkLocation : public NamedObject { +public: + virtual void deserialize(Archive &archive); + +private: + + +}; + +} // End of namespace Pink + +#endif
\ No newline at end of file diff --git a/engines/pink/walk/walk_mgr.cpp b/engines/pink/walk/walk_mgr.cpp new file mode 100644 index 0000000000..f2b947bb9a --- /dev/null +++ b/engines/pink/walk/walk_mgr.cpp @@ -0,0 +1,12 @@ +// +// Created by andrei on 3/17/18. +// + +#include "walk_mgr.h" +#include "../archive.h" + + +void Pink::WalkMgr::deserialize(Pink::Archive &archive) { + // setLeadActorRef; + archive >> _locations; +} diff --git a/engines/pink/walk/walk_mgr.h b/engines/pink/walk/walk_mgr.h new file mode 100644 index 0000000000..27321cf7cb --- /dev/null +++ b/engines/pink/walk/walk_mgr.h @@ -0,0 +1,43 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef PINK_WALK_MGR_H +#define PINK_WALK_MGR_H + +#include <common/array.h> +#include "engines/pink/object.h" + +namespace Pink { + +class WalkLocation; + +class WalkMgr : public Object { +public: + virtual void deserialize(Archive &archive); + +private: + Common::Array<WalkLocation*> _locations; +}; + +} // End of namespace Pink + +#endif |