From bc3e04400843615a77fd8df5a911070350f2323e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 26 Feb 2016 22:08:54 -0500 Subject: TITANIC: Implemented CStartAction and CHammerDispensorButton --- engines/titanic/core/saveable_object.cpp | 6 +++ engines/titanic/game/door_auto_sound_event.cpp | 51 -------------------- engines/titanic/game/door_auto_sound_event.h | 57 ---------------------- engines/titanic/game/hammer_dispensor_button.cpp | 56 ++++++++++++++++++++++ engines/titanic/game/hammer_dispensor_button.h | 60 ++++++++++++++++++++++++ engines/titanic/game/service_elevator_door.h | 2 +- engines/titanic/game/start_action.cpp | 46 ++++++++++++++++++ engines/titanic/game/start_action.h | 55 ++++++++++++++++++++++ engines/titanic/messages/door_auto_sound_event.h | 2 +- engines/titanic/module.mk | 2 + 10 files changed, 227 insertions(+), 110 deletions(-) delete mode 100644 engines/titanic/game/door_auto_sound_event.cpp delete mode 100644 engines/titanic/game/door_auto_sound_event.h create mode 100644 engines/titanic/game/hammer_dispensor_button.cpp create mode 100644 engines/titanic/game/hammer_dispensor_button.h create mode 100644 engines/titanic/game/start_action.cpp create mode 100644 engines/titanic/game/start_action.h diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index e87325a84d..966e441050 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -36,9 +36,11 @@ #include "titanic/core/view_item.h" #include "titanic/game/announce.h" +#include "titanic/game/hammer_dispensor_button.h" #include "titanic/game/pet_position.h" #include "titanic/game/room_item.h" #include "titanic/game/service_elevator_door.h" +#include "titanic/game/start_action.h" #include "titanic/game/sub_glass.h" #include "titanic/game/television.h" @@ -129,9 +131,11 @@ DEFFN(CTreeItem); DEFFN(CViewItem); DEFFN(CAnnounce); +DEFFN(CHammerDispensorButton); DEFFN(CPETPosition); DEFFN(CRoomItem); DEFFN(CServiceElevatorDoor); +DEFFN(CStartAction); DEFFN(CSUBGlass); DEFFN(CTelevision); @@ -215,9 +219,11 @@ void CSaveableObject::initClassList() { ADDFN(CViewItem); ADDFN(CAnnounce); + ADDFN(CHammerDispensorButton); ADDFN(CPETPosition); ADDFN(CRoomItem); ADDFN(CServiceElevatorDoor); + ADDFN(CStartAction); ADDFN(CSUBGlass); ADDFN(CTelevision); diff --git a/engines/titanic/game/door_auto_sound_event.cpp b/engines/titanic/game/door_auto_sound_event.cpp deleted file mode 100644 index 158c147296..0000000000 --- a/engines/titanic/game/door_auto_sound_event.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* 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/game/door_auto_sound_event.h" - -namespace Titanic { - -CDoorAutoSoundEvent::CDoorAutoSoundEvent() : CAutoSoundEvent(), - _string1("z#44.wav"), _string2("z#43.wav"), _fieldDC(25), _fieldE0(25) { -} - -void CDoorAutoSoundEvent::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeQuotedLine(_string1, indent); - file->writeQuotedLine(_string2, indent); - file->writeNumberLine(_fieldDC, indent); - file->writeNumberLine(_fieldE0, indent); - - CAutoSoundEvent::save(file, indent); -} - -void CDoorAutoSoundEvent::load(SimpleFile *file) { - file->readNumber(); - _string1 = file->readString(); - _string2 = file->readString(); - _fieldDC = file->readNumber(); - _fieldE0 = file->readNumber(); - - CAutoSoundEvent::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/game/door_auto_sound_event.h b/engines/titanic/game/door_auto_sound_event.h deleted file mode 100644 index 9bba304daa..0000000000 --- a/engines/titanic/game/door_auto_sound_event.h +++ /dev/null @@ -1,57 +0,0 @@ -/* 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_DOOR_AUTO_SOUND_EVENT_H -#define TITANIC_DOOR_AUTO_SOUND_EVENT_H - -#include "titanic/messages/auto_sound_event.h" - -namespace Titanic { - -class CDoorAutoSoundEvent : public CAutoSoundEvent { -protected: - CString _string1; - CString _string2; - int _fieldDC; - int _fieldE0; -public: - CDoorAutoSoundEvent(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CDoorAutoSoundEvent"; } - - /** - * 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_DOOR_AUTO_SOUND_EVENT_H */ diff --git a/engines/titanic/game/hammer_dispensor_button.cpp b/engines/titanic/game/hammer_dispensor_button.cpp new file mode 100644 index 0000000000..eb9fa3845b --- /dev/null +++ b/engines/titanic/game/hammer_dispensor_button.cpp @@ -0,0 +1,56 @@ +/* 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/game/hammer_dispensor_button.h" + +namespace Titanic { + +CHammerDispensorButton::CHammerDispensorButton() : CStartAction(), + _fieldF8(0), _fieldFC(0), _field100(0), _field104(56), + _field108(6), _field10C(0), _field110(0) { +} + +void CHammerDispensorButton::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldF8, indent); + file->writeNumberLine(_fieldFC, indent); + file->writeNumberLine(_field100, indent); + file->writeNumberLine(_field104, indent); + file->writeNumberLine(_field108, indent); + file->writeNumberLine(_field110, indent); + + CStartAction::save(file, indent); +} + +void CHammerDispensorButton::load(SimpleFile *file) { + file->readNumber(); + _fieldF8 = file->readNumber(); + _fieldFC = file->readNumber(); + _field100 = file->readNumber(); + _field104 = file->readNumber(); + _field108 = file->readNumber(); + _field110 = file->readNumber(); + + CStartAction::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/hammer_dispensor_button.h b/engines/titanic/game/hammer_dispensor_button.h new file mode 100644 index 0000000000..e4b5fc13b1 --- /dev/null +++ b/engines/titanic/game/hammer_dispensor_button.h @@ -0,0 +1,60 @@ +/* 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_HAMMER_DISPENSOR_H +#define TITANIC_HAMMER_DISPENSOR_H + +#include "titanic/game/start_action.h" + +namespace Titanic { + +class CHammerDispensorButton : public CStartAction { +private: + int _fieldF8; + int _fieldFC; + int _field100; + int _field104; + int _field108; + int _field10C; + int _field110; +public: + CHammerDispensorButton(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CHammerDispensorButton"; } + + /** + * 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_HAMMER_DISPENSOR_H */ diff --git a/engines/titanic/game/service_elevator_door.h b/engines/titanic/game/service_elevator_door.h index 3ad897c089..a3a8388405 100644 --- a/engines/titanic/game/service_elevator_door.h +++ b/engines/titanic/game/service_elevator_door.h @@ -23,7 +23,7 @@ #ifndef TITANIC_SERVICE_ELEVATOR_DOOR_H #define TITANIC_SERVICE_ELEVATOR_DOOR_H -#include "titanic/game/door_auto_sound_event.h" +#include "titanic/messages/door_auto_sound_event.h" namespace Titanic { diff --git a/engines/titanic/game/start_action.cpp b/engines/titanic/game/start_action.cpp new file mode 100644 index 0000000000..9bafd01282 --- /dev/null +++ b/engines/titanic/game/start_action.cpp @@ -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. + * + */ + +#include "titanic/game/start_action.h" + +namespace Titanic { + +CStartAction::CStartAction() : CBackground() { +} + +void CStartAction::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string3, indent); + file->writeQuotedLine(_string4, indent); + + CBackground::save(file, indent); +} + +void CStartAction::load(SimpleFile *file) { + file->readNumber(); + _string3 = file->readString(); + _string4 = file->readString(); + + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/start_action.h b/engines/titanic/game/start_action.h new file mode 100644 index 0000000000..3725dbc4a0 --- /dev/null +++ b/engines/titanic/game/start_action.h @@ -0,0 +1,55 @@ +/* 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_START_ACTION_H +#define TITANIC_START_ACTION_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CStartAction : public CBackground { +protected: + CString _string3; + CString _string4; +public: + CStartAction(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CStartAction"; } + + /** + * 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_START_ACTION_H */ diff --git a/engines/titanic/messages/door_auto_sound_event.h b/engines/titanic/messages/door_auto_sound_event.h index a231b2fa52..9bba304daa 100644 --- a/engines/titanic/messages/door_auto_sound_event.h +++ b/engines/titanic/messages/door_auto_sound_event.h @@ -28,7 +28,7 @@ namespace Titanic { class CDoorAutoSoundEvent : public CAutoSoundEvent { -private: +protected: CString _string1; CString _string2; int _fieldDC; diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index d8d87f0b8d..e10fe31e42 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -34,9 +34,11 @@ MODULE_OBJS := \ core/tree_item.o \ core/view_item.o \ game/announce.o \ + game/hammer_dispensor_button.o \ game/pet_position.o \ game/room_item.o \ game/service_elevator_door.o \ + game/start_action.o \ game/sub_glass.o \ game/television.o \ gfx/act_button.o \ -- cgit v1.2.3