aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2016-05-16 07:40:10 -0400
committerPaul Gilbert2016-07-15 19:12:00 -0400
commite1ba9672330802c458aebd7049e8ae3f4b23f9ca (patch)
treefb437a6bfc4b5039c1d6e07b86f13a415d5e426e
parentb37da849c936cc1842969b150e84dd0ad145f576 (diff)
downloadscummvm-rg350-e1ba9672330802c458aebd7049e8ae3f4b23f9ca.tar.gz
scummvm-rg350-e1ba9672330802c458aebd7049e8ae3f4b23f9ca.tar.bz2
scummvm-rg350-e1ba9672330802c458aebd7049e8ae3f4b23f9ca.zip
TITANIC: Moved other static arrays from Titanic engine to dat file
-rw-r--r--engines/titanic/support/exe_resources.cpp3
-rw-r--r--engines/titanic/support/exe_resources.h2
-rw-r--r--engines/titanic/titanic.cpp121
-rw-r--r--engines/titanic/titanic.h18
-rw-r--r--engines/titanic/true_talk/tt_parser.cpp12
5 files changed, 85 insertions, 71 deletions
diff --git a/engines/titanic/support/exe_resources.cpp b/engines/titanic/support/exe_resources.cpp
index 91139dce3d..522e92f718 100644
--- a/engines/titanic/support/exe_resources.cpp
+++ b/engines/titanic/support/exe_resources.cpp
@@ -21,11 +21,12 @@
*/
#include "titanic/support/exe_resources.h"
+#include "titanic/titanic.h"
namespace Titanic {
CExeResources::CExeResources() : _owner(nullptr), _field4(0), _field8(0),
- _fieldC(0), _field10(0), _field14(0), _field18(0) {
+ _fieldC(0), _field10(0), _field14(0), _field18(0) {
}
void CExeResources::reset(CScriptHandler *owner, int val1, int val2) {
diff --git a/engines/titanic/support/exe_resources.h b/engines/titanic/support/exe_resources.h
index bb760626d4..49e05aa56f 100644
--- a/engines/titanic/support/exe_resources.h
+++ b/engines/titanic/support/exe_resources.h
@@ -23,8 +23,6 @@
#ifndef TITANIC_EXE_RESOURCES_H
#define TITANIC_EXE_RESOURCES_H
-#include "common/file.h"
-
namespace Titanic {
class CScriptHandler;
diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp
index c2c1f18f54..38d536cab6 100644
--- a/engines/titanic/titanic.cpp
+++ b/engines/titanic/titanic.cpp
@@ -40,6 +40,7 @@
#include "titanic/moves/enter_exit_first_class_state.h"
#include "titanic/moves/enter_exit_sec_class_mini_lift.h"
#include "titanic/moves/exit_pellerator.h"
+#include "titanic/support/simple_file.h"
namespace Titanic {
@@ -81,8 +82,6 @@ void TitanicEngine::initialize() {
DebugMan.addDebugChannel(kDebugGraphics, "graphics", "Graphics handling");
DebugMan.addDebugChannel(kDebugSound, "sound", "Sound and Music handling");
- setItemNames();
- setRoomNames();
CSaveableObject::initClassList();
CEnterExitFirstClassState::init();
CGetLiftEye2::init();
@@ -101,6 +100,11 @@ void TitanicEngine::initialize() {
_screen = new Graphics::Screen(0, 0);
_screenManager = new OSScreenManager(this);
_window = new CMainGameWindow(this);
+
+ setItemNames();
+ setRoomNames();
+ setParserStrings();
+
_window->applicationStarting();
}
@@ -127,72 +131,61 @@ Common::Error TitanicEngine::run() {
return Common::kNoError;
}
+static CString readString(Common::SeekableReadStream *s) {
+ CString result;
+ char c;
+ while ((c = s->readByte()) != '\0')
+ result += c;
+
+ return result;
+}
+
void TitanicEngine::setItemNames() {
- static const char *const NAMES[TOTAL_ITEMS] = {
- "LeftArmWith", "LeftArmWithout", "RightArmWith", "RightArmWithout", "BridgeRed",
- "BridgeYellow", "BridgeBlue", "BridgeGreen", "Parrot", "CentralCore", "BrainGreen",
- "BrainYellow", "BrainRed", "BrainBlue", "ChickenGreasy", "ChickenPlain", "ChickenPurple",
- "ChickenRed", "ChickenYellow", "CrushedTV", "Ear", "Ear1", "Eyeball", "Eyeball1",
- "Feather", "Lemon", "GlassEmpty", "GlassPurple", "GlassRed", "GlassYellow", "Hammer",
- "Hose", "HoseEnd", "LiftHead", "LongStick", "Magazine", "Mouth", "MusicKey", "Napkin",
- "Nose", "Perch", "PhonoCylinder", "PhonoCylinder1", "PhonoCylinder2", "PhonoCylinder3",
- "Photo"
- };
- for (uint idx = 0; idx < TOTAL_ITEMS; ++idx)
- _itemNames[idx] = NAMES[idx];
-
- // Item descriptions
- static const char *const DESCRIPTIONS[TOTAL_ITEMS] = {
- "The Maitre d'Bot's left arm holding a key", "The Maitre d'Bot's left arm",
- "The Maitre d'Bot's right arm holding Titania's auditory center",
- "The Maitre d'Bot's right arm", "Red Fuse", "Yellow Fuse", "Blue Fuse",
- "Green Fuse", "The Parrot", "Titania's central intelligence core",
- "Titania's auditory center", "Titania's olfactory center",
- "Titania's speech center", "Titania's vision center", "rather greasy chicken",
- "very plain chicken", "chicken smeared with starling pur$e",
- "chicken covered with tomato sauce", "chicken coated in mustard sauce",
- "A crushed television set", "Titania's ear", "Titania's ear", "Titania's eye",
- "Titania's eye", "A parrot feather", "A nice fat juicy lemon",
- "An empty beer glass", "A beer glass containing pur$ed flock of starlings",
- "A beer glass containing tomato sauce", "A beer glass containing mustard sauce",
- "A hammer", "A hose", "The other end of a hose", "The LiftBot's head",
- "A rather long stick", "A magazine", "Titania's mouth", "A key",
- "A super-absorbent napkin", "Titania's nose", "A perch", "A phonograph cylinder",
- "A phonograph cylinder", "A phonograph cylinder", "A phonograph cylinder",
- "A photograph"
- };
- for (uint idx = 0; idx < TOTAL_ITEMS; ++idx)
- _itemDescriptions[idx] = DESCRIPTIONS[idx];
-
- // Item identifiers
- static const char *const ITEM_IDS[40] = {
- "MaitreD Left Arm", "MaitreD Right Arm", "OlfactoryCentre", "AuditoryCentre",
- "SpeechCentre", "VisionCentre", "CentralCore", "Perch", "SeasonBridge",
- "FanBridge", "BeamBridge", "ChickenBridge", "CarryParrot", "Chicken",
- "CrushedTV", "Feathers", "Lemon", "BeerGlass", "BigHammer", "Ear1", "Ear 2",
- "Eye1", "Eye2", "Mouth", "Nose", "NoseSpare", "Hose", "DeadHoseSpare",
- "HoseEnd", "DeadHoseEndSpare", "BrokenLiftbotHead", "LongStick", "Magazine",
- "Napkin", "Phonograph Cylinder", "Phonograph Cylinder 1", "Phonograph Cylinder 2",
- "Phonograph Cylinder 3", "Photograph", "Music System Key"
- };
- for (uint idx = 0; idx < 40; ++idx)
- _itemIds[idx] = ITEM_IDS[idx];
+ Common::SeekableReadStream *r;
+ r = g_vm->_filesManager->getResource("TEXT/ITEM_NAMES");
+ while (r->pos() < r->size())
+ _itemNames.push_back(readString(r));
+ delete r;
+
+ r = g_vm->_filesManager->getResource("TEXT/ITEM_DESCRIPTIONS");
+ while (r->pos() < r->size())
+ _itemNames.push_back(readString(r));
+ delete r;
+
+ r = g_vm->_filesManager->getResource("TEXT/ITEM_IDS");
+ while (r->pos() < r->size())
+ _itemIds.push_back(readString(r));
+ delete r;
}
void TitanicEngine::setRoomNames() {
- static const char *const ROOM_NAMES[TOTAL_ROOMS] = {
- "1stClassLobby", "1stClassRestaurant", "1stClassState",
- "2ndClassLobby", "secClassState", "Arboretum", "FrozenArboretum",
- "Bar", "BilgeRoom", "BilgeRoomWith", "BottomOfWell", "Bridge",
- "CreatorsChamber", "CreatorsChamberOn", "Dome", "Home", "Lift",
- "EmbLobby", "MoonEmbLobby", "MusicRoomLobby", "MusicRoom",
- "ParrotLobby", "Pellerator", "PromenadeDeck", "SculptureChamber",
- "SecClassLittleLift", "ServiceElevator", "SGTLeisure", "SGTLittleLift",
- "SgtLobby", "SGTState", "Titania", "TopOfWell", "PlayersRoom"
- };
-
- for (uint idx = 0; idx < TOTAL_ROOMS; ++idx)
- _roomNames[idx] = ROOM_NAMES[idx];
+ Common::SeekableReadStream *r = g_vm->_filesManager->getResource("TEXT/ROOM_NAMES");
+ while (r->pos() < r->size())
+ _roomNames.push_back(readString(r));
+ delete r;
+}
+
+void TitanicEngine::setParserStrings() {
+ Common::SeekableReadStream *r;
+ r = g_vm->_filesManager->getResource("TEXT/REPLACEMENTS1");
+ while (r->pos() < r->size())
+ _replacements1.push_back(readString(r));
+ delete r;
+
+ r = g_vm->_filesManager->getResource("TEXT/REPLACEMENTS2");
+ while (r->pos() < r->size())
+ _replacements2.push_back(readString(r));
+ delete r;
+
+ r = g_vm->_filesManager->getResource("TEXT/REPLACEMENTS3");
+ while (r->pos() < r->size())
+ _replacements3.push_back(readString(r));
+ delete r;
+
+ r = g_vm->_filesManager->getResource("TEXT/PHRASES");
+ while (r->pos() < r->size())
+ _phrases.push_back(readString(r));
+ delete r;
}
} // End of namespace Titanic
diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h
index c30ad36ac2..95d1abae04 100644
--- a/engines/titanic/titanic.h
+++ b/engines/titanic/titanic.h
@@ -25,6 +25,7 @@
#include "common/scummsys.h"
#include "common/random.h"
+#include "common/str-array.h"
#include "common/system.h"
#include "common/serializer.h"
#include "engines/advancedDetector.h"
@@ -102,6 +103,11 @@ private:
* Sets up the list of room names
*/
void setRoomNames();
+
+ /**
+ * Set the replacement strings and common phrases lists used by the praser
+ */
+ void setParserStrings();
protected:
const TitanicGameDescription *_gameDescription;
int _loadSaveSlot;
@@ -122,11 +128,15 @@ public:
TTscriptBase *_script;
CExeResources _exeResources;
CMovieList _activeMovies;
- CString _itemNames[TOTAL_ITEMS];
- CString _itemDescriptions[TOTAL_ITEMS];
+ StringArray _itemNames;
+ StringArray _itemDescriptions;
CString _itemObjects[TOTAL_ITEMS];
- CString _itemIds[40];
- CString _roomNames[TOTAL_ROOMS];
+ StringArray _itemIds;
+ StringArray _roomNames;
+ StringArray _replacements1;
+ StringArray _replacements2;
+ StringArray _replacements3;
+ StringArray _phrases;
public:
TitanicEngine(OSystem *syst, const TitanicGameDescription *gameDesc);
virtual ~TitanicEngine();
diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp
index d896923f2b..4fdaf58671 100644
--- a/engines/titanic/true_talk/tt_parser.cpp
+++ b/engines/titanic/true_talk/tt_parser.cpp
@@ -23,6 +23,7 @@
#include "titanic/true_talk/tt_parser.h"
#include "titanic/true_talk/script_handler.h"
#include "titanic/true_talk/tt_input.h"
+#include "titanic/titanic.h"
namespace Titanic {
@@ -32,6 +33,17 @@ int TTparser::processInput(TTinput *input) {
return 0;
// Scan for and replace common slang and contractions with verbose versions
+ searchAndReplace(input->_normalizedLine, g_vm->_replacements1);
+ searchAndReplace(input->_normalizedLine, g_vm->_replacements2);
+
+ // Check entire normalized line against common phrases to replace
+ for (uint idx = 0; idx < g_vm->_phrases.size(); idx += 2) {
+ if (!g_vm->_phrases[idx].compareTo(input->_normalizedLine))
+ input->_normalizedLine = g_vm->_phrases[idx + 1];
+ }
+
+ // Do a further search and replace of roman numerals to decimal
+ searchAndReplace(input->_normalizedLine, g_vm->_replacements3);
warning("TODO: TTparser::processInput");
return 0;