From 9eaab29afedf9eceee50f882b64cb39a14e616a2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 25 Feb 2014 19:52:35 -0500 Subject: MADS: Starting to refactor some Scene array fields as separate classes --- engines/mads/game_data.h | 126 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 engines/mads/game_data.h (limited to 'engines/mads/game_data.h') diff --git a/engines/mads/game_data.h b/engines/mads/game_data.h new file mode 100644 index 0000000000..2d2badd38b --- /dev/null +++ b/engines/mads/game_data.h @@ -0,0 +1,126 @@ +/* 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 MADS_GAME_DATA_H +#define MADS_GAME_DATA_H + +#include "common/scummsys.h" +#include "common/array.h" + +namespace MADS { + +class MADSEngine; +class Game; + +class VisitedScenes: public Common::Array<int> { +public: + /** + * Returns true if a given Scene Id exists in the listed of previously visited scenes. + */ + bool exists(int sceneId); + + /** + * Adds a scene Id to the list of previously visited scenes, if it doesn't already exist + */ + void add(int sceneId); +}; + +class InventoryObject { +public: + int _descId; + int _roomNumber; + int _article; + int _vocabCount; + struct { + int _actionFlags1; + int _actionFlags2; + int _vocabId; + } _vocabList[3]; + char _mutilateString[10]; // ??? + const byte *_objFolder; // ??? + + /** + * Loads the data for a given object + */ + void load(Common::SeekableReadStream &f); +}; + +class InventoryObjects: public Common::Array<InventoryObject> { +private: + MADSEngine *_vm; +public: + Common::Array<int> _inventoryList; + + /** + * Constructor + */ + InventoryObjects(MADSEngine *vm): _vm(vm) {} + + /** + * Loads the game's object list + */ + void load(); + + /** + * Set the associated data? pointer with an inventory object + */ + void setData(int objIndex, int id, const byte *p); + + /** + * Sets the room number + */ + void setRoom(int objectId, int roomNumber); +}; + +class Player { +public: + int _direction; + int _newDirection; + bool _spritesLoaded; + int _spritesStart; + int _numSprites; + bool _stepEnabled; + bool _spritesChanged; + bool _visible; +public: + Player(); + + void loadSprites(const Common::String &prefix) { + warning("TODO: Player::loadSprites"); + } +}; + +class SectionHandler { +protected: + MADSEngine *_vm; +public: + SectionHandler(MADSEngine *vm): _vm(vm) {} + virtual ~SectionHandler() {} + + virtual void preLoadSection() = 0; + virtual void sectionPtr2() = 0; + virtual void postLoadSection() = 0; +}; + +} // End of namespace MADS + +#endif /* MADS_GAME_DATA_H */ -- cgit v1.2.3 From 72163a233f980a385c432fbf66fd6bb21f6acdf2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 2 Mar 2014 20:06:21 -0500 Subject: MADS: Moved Player class into it's own file --- engines/mads/game_data.h | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'engines/mads/game_data.h') diff --git a/engines/mads/game_data.h b/engines/mads/game_data.h index 2d2badd38b..56ab3665e3 100644 --- a/engines/mads/game_data.h +++ b/engines/mads/game_data.h @@ -91,24 +91,6 @@ public: void setRoom(int objectId, int roomNumber); }; -class Player { -public: - int _direction; - int _newDirection; - bool _spritesLoaded; - int _spritesStart; - int _numSprites; - bool _stepEnabled; - bool _spritesChanged; - bool _visible; -public: - Player(); - - void loadSprites(const Common::String &prefix) { - warning("TODO: Player::loadSprites"); - } -}; - class SectionHandler { protected: MADSEngine *_vm; -- cgit v1.2.3 From 10124f6806150aad409f6db9a6c7a60afcb44872 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 15 Mar 2014 17:38:44 -0400 Subject: MADS: Implemented scene 103 setup and needed support methods --- engines/mads/game_data.h | 52 +++++------------------------------------------- 1 file changed, 5 insertions(+), 47 deletions(-) (limited to 'engines/mads/game_data.h') diff --git a/engines/mads/game_data.h b/engines/mads/game_data.h index 56ab3665e3..7674beed81 100644 --- a/engines/mads/game_data.h +++ b/engines/mads/game_data.h @@ -33,6 +33,11 @@ class Game; class VisitedScenes: public Common::Array<int> { public: + /** + * Stores true when a previously visited scene is revisited + */ + bool _sceneRevisited; + /** * Returns true if a given Scene Id exists in the listed of previously visited scenes. */ @@ -44,53 +49,6 @@ public: void add(int sceneId); }; -class InventoryObject { -public: - int _descId; - int _roomNumber; - int _article; - int _vocabCount; - struct { - int _actionFlags1; - int _actionFlags2; - int _vocabId; - } _vocabList[3]; - char _mutilateString[10]; // ??? - const byte *_objFolder; // ??? - - /** - * Loads the data for a given object - */ - void load(Common::SeekableReadStream &f); -}; - -class InventoryObjects: public Common::Array<InventoryObject> { -private: - MADSEngine *_vm; -public: - Common::Array<int> _inventoryList; - - /** - * Constructor - */ - InventoryObjects(MADSEngine *vm): _vm(vm) {} - - /** - * Loads the game's object list - */ - void load(); - - /** - * Set the associated data? pointer with an inventory object - */ - void setData(int objIndex, int id, const byte *p); - - /** - * Sets the room number - */ - void setRoom(int objectId, int roomNumber); -}; - class SectionHandler { protected: MADSEngine *_vm; -- cgit v1.2.3 From 2b141aaba681a3c7b848010cd58768f55f4434a3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 21 Mar 2014 09:27:22 -0400 Subject: MADS: Fixes for screen objects loading and checking --- engines/mads/game_data.h | 1 + 1 file changed, 1 insertion(+) (limited to 'engines/mads/game_data.h') diff --git a/engines/mads/game_data.h b/engines/mads/game_data.h index 7674beed81..8b31e5260c 100644 --- a/engines/mads/game_data.h +++ b/engines/mads/game_data.h @@ -59,6 +59,7 @@ public: virtual void preLoadSection() = 0; virtual void sectionPtr2() = 0; virtual void postLoadSection() = 0; + virtual void step() {} }; } // End of namespace MADS -- cgit v1.2.3 From bb5edf5426c3d8717d3a3f843a3dbf6193bbe9e9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 26 Apr 2014 11:01:21 -0400 Subject: MADS: Implemented more save/load logic --- engines/mads/game_data.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'engines/mads/game_data.h') diff --git a/engines/mads/game_data.h b/engines/mads/game_data.h index 8b31e5260c..1a8791e815 100644 --- a/engines/mads/game_data.h +++ b/engines/mads/game_data.h @@ -47,6 +47,11 @@ public: * Adds a scene Id to the list of previously visited scenes, if it doesn't already exist */ void add(int sceneId); + + /** + * Synchronizes the list + */ + void synchronize(Common::Serializer &s); }; class SectionHandler { -- cgit v1.2.3 From b5949010a61e3d12f22ea762ed8d09cc1a79b850 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 1 May 2014 22:36:36 -0400 Subject: MADS: Implemented more savegame synchronization --- engines/mads/game_data.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'engines/mads/game_data.h') diff --git a/engines/mads/game_data.h b/engines/mads/game_data.h index 1a8791e815..6ea59d6d2b 100644 --- a/engines/mads/game_data.h +++ b/engines/mads/game_data.h @@ -25,13 +25,14 @@ #include "common/scummsys.h" #include "common/array.h" +#include "mads/resources.h" namespace MADS { class MADSEngine; class Game; -class VisitedScenes: public Common::Array<int> { +class VisitedScenes: public SynchronizedList { public: /** * Stores true when a previously visited scene is revisited -- cgit v1.2.3 From 9866aba2e43da914a17d17b695456ca25a875469 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 27 May 2014 00:58:25 +0200 Subject: MADS: Slight formatting fixes. --- engines/mads/game_data.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/mads/game_data.h') diff --git a/engines/mads/game_data.h b/engines/mads/game_data.h index 6ea59d6d2b..cf2d0bdf60 100644 --- a/engines/mads/game_data.h +++ b/engines/mads/game_data.h @@ -59,7 +59,7 @@ class SectionHandler { protected: MADSEngine *_vm; public: - SectionHandler(MADSEngine *vm): _vm(vm) {} + SectionHandler(MADSEngine *vm) : _vm(vm) {} virtual ~SectionHandler() {} virtual void preLoadSection() = 0; -- cgit v1.2.3 From db3ca8255fd0f237e2b180a94e3124e0caf00e45 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 27 May 2014 00:58:25 +0200 Subject: MADS: More formatting fixes. Add space before : in inheritance. --- engines/mads/game_data.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/mads/game_data.h') diff --git a/engines/mads/game_data.h b/engines/mads/game_data.h index cf2d0bdf60..f15cd1a8f0 100644 --- a/engines/mads/game_data.h +++ b/engines/mads/game_data.h @@ -32,7 +32,7 @@ namespace MADS { class MADSEngine; class Game; -class VisitedScenes: public SynchronizedList { +class VisitedScenes : public SynchronizedList { public: /** * Stores true when a previously visited scene is revisited -- cgit v1.2.3 From 6d6afda8835f996720cfc395fdb1e77daac3d473 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 1 Jun 2014 15:01:17 +0300 Subject: MADS: Properly set the scene revisited flag when loading a saved game --- engines/mads/game_data.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/mads/game_data.h') diff --git a/engines/mads/game_data.h b/engines/mads/game_data.h index f15cd1a8f0..65a9ae1553 100644 --- a/engines/mads/game_data.h +++ b/engines/mads/game_data.h @@ -52,7 +52,7 @@ public: /** * Synchronizes the list */ - void synchronize(Common::Serializer &s); + void synchronize(Common::Serializer &s, int sceneId); }; class SectionHandler { -- cgit v1.2.3