diff options
author | Paul Gilbert | 2016-02-25 22:21:43 -0500 |
---|---|---|
committer | Paul Gilbert | 2016-02-25 22:21:43 -0500 |
commit | 5c77a55328f98f1df79de86f82135ed60ee6f4fd (patch) | |
tree | 7e784fe2b6bf5e9dce972d833abc6517c2529a40 /engines/titanic | |
parent | f2cb4a6d98d914aa0557f35c84d3052d9739c5d5 (diff) | |
download | scummvm-rg350-5c77a55328f98f1df79de86f82135ed60ee6f4fd.tar.gz scummvm-rg350-5c77a55328f98f1df79de86f82135ed60ee6f4fd.tar.bz2 scummvm-rg350-5c77a55328f98f1df79de86f82135ed60ee6f4fd.zip |
TITANIC: Implemented CBackground class
Diffstat (limited to 'engines/titanic')
-rw-r--r-- | engines/titanic/core/background.cpp | 52 | ||||
-rw-r--r-- | engines/titanic/core/background.h | 58 | ||||
-rw-r--r-- | engines/titanic/core/saveable_object.cpp | 3 | ||||
-rw-r--r-- | engines/titanic/module.mk | 1 |
4 files changed, 114 insertions, 0 deletions
diff --git a/engines/titanic/core/background.cpp b/engines/titanic/core/background.cpp new file mode 100644 index 0000000000..63aaf30ae0 --- /dev/null +++ b/engines/titanic/core/background.cpp @@ -0,0 +1,52 @@ +/* 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 "titanic/core/background.h" + +namespace Titanic { + +CBackground::CBackground() : CGameObject(), _fieldBC(0), _fieldC0(0), _fieldDC(0) { +} + +void CBackground::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + file->writeQuotedLine(_string1, indent); + file->writeQuotedLine(_string2, indent); + file->writeNumberLine(_fieldDC, indent); + + CGameObject::save(file, indent); +} + +void CBackground::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + _string1 = file->readString(); + _string2 = file->readString(); + _fieldDC = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/core/background.h b/engines/titanic/core/background.h new file mode 100644 index 0000000000..a4735250ae --- /dev/null +++ b/engines/titanic/core/background.h @@ -0,0 +1,58 @@ +/* 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 TITANIC_BACKGROUND_H +#define TITANIC_BACKGROUND_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CBackground : public CGameObject { +protected: + int _fieldBC; + int _fieldC0; + CString _string1; + CString _string2; + int _fieldDC; +public: + CBackground(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CBackground"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_BACKGROUND_H */ diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 758c56cfa5..551cd47278 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -21,6 +21,7 @@ */ #include "titanic/core/saveable_object.h" +#include "titanic/core/background.h" #include "titanic/core/file_item.h" #include "titanic/core/link_item.h" #include "titanic/core/list.h" @@ -57,6 +58,7 @@ Common::HashMap<Common::String, CSaveableObject::CreateFunction> * #define ADDFN(T) (*_classList)[#T] = Function##T DEFFN(CAnnounce); +DEFFN(CBackground); DEFFN(CBarbot); DEFFN(CBellBot); DEFFN(CDeskbot); @@ -86,6 +88,7 @@ DEFFN(CViewItem); void CSaveableObject::initClassList() { _classList = new Common::HashMap<Common::String, CreateFunction>(); ADDFN(CAnnounce); + ADDFN(CBackground); ADDFN(CBarbot); ADDFN(CBellBot); ADDFN(CDeskbot); diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 3fadf67fd4..74206ea262 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -16,6 +16,7 @@ MODULE_OBJS := \ titanic.o \ video_surface.o \ core/auto_sound_event.o \ + core/background.o \ core/dont_save_file_item.o \ core/file_item.o \ core/game_object.o \ |