From c4375b134a57e3217d24e146592560f1ba9342d7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 8 May 2016 12:09:32 -0400 Subject: TITANIC: Beginnings of STVocab class, CScriptHandler constructor --- engines/titanic/module.mk | 2 ++ engines/titanic/support/file_reader.cpp | 29 ++++++++++++++++ engines/titanic/support/file_reader.h | 38 +++++++++++++++++++++ engines/titanic/titanic.h | 2 ++ engines/titanic/true_talk/script_handler.cpp | 7 +++- engines/titanic/true_talk/script_handler.h | 6 ++-- engines/titanic/true_talk/st_vocab.cpp | 37 ++++++++++++++++++++ engines/titanic/true_talk/st_vocab.h | 50 ++++++++++++++++++++++++++++ engines/titanic/true_talk/title_engine.h | 3 +- 9 files changed, 169 insertions(+), 5 deletions(-) create mode 100644 engines/titanic/support/file_reader.cpp create mode 100644 engines/titanic/support/file_reader.h create mode 100644 engines/titanic/true_talk/st_vocab.cpp create mode 100644 engines/titanic/true_talk/st_vocab.h (limited to 'engines') diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index a0f0efb7b0..d808f77928 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -431,6 +431,7 @@ MODULE_OBJS := \ star_control/star_control_sub15.o \ support/direct_draw.o \ support/direct_draw_surface.o \ + support/file_reader.o \ support/files_manager.o \ support/font.o \ support/image.o \ @@ -458,6 +459,7 @@ MODULE_OBJS := \ true_talk/succubus_script.o \ true_talk/title_engine.o \ true_talk/script_handler.o \ + true_talk/st_vocab.o \ true_talk/true_talk_manager.o \ true_talk/tt_script_base.o \ true_talk/tt_room_script.o \ diff --git a/engines/titanic/support/file_reader.cpp b/engines/titanic/support/file_reader.cpp new file mode 100644 index 0000000000..c332d9995c --- /dev/null +++ b/engines/titanic/support/file_reader.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 "titanic/support/file_reader.h" + +namespace Titanic { + + + +} // End of namespace Titanic diff --git a/engines/titanic/support/file_reader.h b/engines/titanic/support/file_reader.h new file mode 100644 index 0000000000..7e9eb1ac20 --- /dev/null +++ b/engines/titanic/support/file_reader.h @@ -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. + * + */ + +#ifndef TITANIC_FILE_READER_H +#define TITANIC_FILE_READER_H + +#include "common/file.h" + +namespace Titanic { + +class CFileReader { +public: + Common::File _file; +public: +}; + +} // End of namespace Titanic + +#endif /* TITANIC_FILE_READER_H */ diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h index a5cf0ff9b8..b773bec332 100644 --- a/engines/titanic/titanic.h +++ b/engines/titanic/titanic.h @@ -34,6 +34,7 @@ #include "titanic/events.h" #include "titanic/support/files_manager.h" #include "titanic/main_game_window.h" +#include "titanic/support/file_reader.h" #include "titanic/support/movie.h" #include "titanic/support/screen_manager.h" #include "titanic/support/string.h" @@ -116,6 +117,7 @@ public: OSScreenManager *_screenManager; CMainGameWindow *_window; Common::RandomSource _randomSource; + CFileReader _fileReader; CMovieList _activeMovies; CString _itemNames[TOTAL_ITEMS]; CString _itemDescriptions[TOTAL_ITEMS]; diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp index e902d0c874..beb5bee996 100644 --- a/engines/titanic/true_talk/script_handler.cpp +++ b/engines/titanic/true_talk/script_handler.cpp @@ -21,12 +21,17 @@ */ #include "titanic/true_talk/script_handler.h" +#include "titanic/titanic.h" namespace Titanic { /*------------------------------------------------------------------------*/ -CScriptHandler::CScriptHandler(CTitleEngine *owner, int val1, int val2) { +CScriptHandler::CScriptHandler(CTitleEngine *owner, int val1, int val2) : + _owner(owner), _script(owner->_script), _reader(g_vm->_fileReader), + _vocab(val2), _field10(0), _field14(0), _field18(0), _inputCtr(0), + _field20(0), _field24(0), _field28(0), _field2C(0), _field30(0) { + } int CScriptHandler::scriptChanged(TTRoomScript *roomScript, TTNpcScript *npcScript, uint dialogueId) { diff --git a/engines/titanic/true_talk/script_handler.h b/engines/titanic/true_talk/script_handler.h index 868a2c3eaa..fba1e41a2e 100644 --- a/engines/titanic/true_talk/script_handler.h +++ b/engines/titanic/true_talk/script_handler.h @@ -26,6 +26,8 @@ #include "titanic/true_talk/tt_npc_script.h" #include "titanic/true_talk/tt_room_script.h" #include "titanic/true_talk/tt_string.h" +#include "titanic/true_talk/st_vocab.h" +#include "titanic/support/file_reader.h" namespace Titanic { @@ -35,8 +37,8 @@ class CScriptHandler { private: CTitleEngine *_owner; TTScriptBase *_script; - int _field8; - int _fieldC; + CFileReader &_reader; + STVocab _vocab; int _field10; int _field14; int _field18; diff --git a/engines/titanic/true_talk/st_vocab.cpp b/engines/titanic/true_talk/st_vocab.cpp new file mode 100644 index 0000000000..ed41a4a61b --- /dev/null +++ b/engines/titanic/true_talk/st_vocab.cpp @@ -0,0 +1,37 @@ +/* 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/true_talk/st_vocab.h" + +namespace Titanic { + +STVocab::STVocab(int val): _field0(0), _field4(0), _field8(0), + _fieldC(0), _field10(0), _field18(val) { + _field14 = load("STvocab.txt"); +} + +int STVocab::load(const CString &name) { + // TODO + return 0; +} + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/st_vocab.h b/engines/titanic/true_talk/st_vocab.h new file mode 100644 index 0000000000..2b4ebb8d72 --- /dev/null +++ b/engines/titanic/true_talk/st_vocab.h @@ -0,0 +1,50 @@ +/* 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_ST_VOCAB_H +#define TITANIC_ST_VOCAB_H + +#include "titanic/support/string.h" + +namespace Titanic { + +class STVocab { +private: + int _field0; + int _field4; + int _field8; + int _fieldC; + int _field10; + int _field14; + int _field18; +private: + /** + * Load the vocab data + */ + int load(const CString &name); +public: + STVocab(int val); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ST_VOCAB_H */ diff --git a/engines/titanic/true_talk/title_engine.h b/engines/titanic/true_talk/title_engine.h index 389e376516..12a02e2b81 100644 --- a/engines/titanic/true_talk/title_engine.h +++ b/engines/titanic/true_talk/title_engine.h @@ -33,10 +33,9 @@ namespace Titanic { class CTitleEngine { -protected: - TTScriptBase *_script; public: CScriptHandler *_scriptHandler; + TTScriptBase *_script; public: CTitleEngine(); ~CTitleEngine(); -- cgit v1.2.3