1 /* ScummVM - Graphic Adventure Engine 2 * 3 * ScummVM is the legal property of its developers, whose names 4 * are too numerous to list here. Please refer to the COPYRIGHT 5 * file distributed with this source distribution. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #ifndef TITANIC_TT_CONCEPT_H 24 #define TITANIC_TT_CONCEPT_H 25 26 #include "titanic/true_talk/tt_string.h" 27 #include "titanic/true_talk/tt_word.h" 28 29 namespace Titanic { 30 31 enum ScriptType { ST_UNKNOWN_SCRIPT = 0, ST_ROOM_SCRIPT = 1, ST_NPC_SCRIPT = 2 }; 32 33 class TTscriptBase; 34 class TTword; 35 36 class TTconcept { 37 private: 38 TTstring _string1; 39 int _field1C; 40 TTword *_word2P; 41 int _field30; 42 bool _flag; 43 int _status; 44 private: 45 /** 46 * Sets the status of the concept 47 */ 48 bool setStatus(); 49 50 /** 51 * Sets the script type and resets other fields 52 */ 53 void setScriptType(ScriptType scriptType); 54 55 /** 56 * Sets up the concept for a word reference 57 */ 58 int initializeWordRef(TTword *word); 59 60 /** 61 * Resets the concept 62 */ 63 void reset(); 64 65 /** 66 * Initialize inner data for the concept from a given source concept 67 */ 68 void initialize(TTconcept &src); 69 public: 70 TTconcept *_nextP; 71 TTscriptBase *_scriptP; 72 TTword *_wordP; 73 int _scriptType; 74 int _field14; 75 int _field20; 76 int _field34; 77 TTstring _string2; 78 public: 79 TTconcept(); 80 TTconcept(TTscriptBase *script, ScriptType scriptType); 81 TTconcept(TTword *word, ScriptType scriptType = ST_UNKNOWN_SCRIPT); 82 TTconcept(TTconcept &src); 83 ~TTconcept(); 84 85 /** 86 * Destroys any attached sibling concepts to the given concept 87 */ 88 void deleteSiblings(); 89 90 /** 91 * Copies data from a source concept 92 */ 93 void copyFrom(TTconcept *src); 94 95 /** 96 * Compares the name of the associated word, if any, to the passed string 97 */ 98 bool compareTo(const char *str) const; 99 100 /** 101 * Compares the concept to the specified word 102 */ 103 bool compareTo(TTword *word) const; 104 105 /** 106 * Set an owner for the concept 107 */ 108 int setOwner(TTconcept *src); 109 110 /** 111 * Set an owner for the concept 112 */ 113 int setOwner(TTword *src, bool dontDup); 114 115 /** 116 * Return the status of the concept 117 */ getStatus()118 int getStatus() const { return _status; } 119 120 /** 121 * True true if the concept is valid 122 */ isValid()123 bool isValid() const { return _status == SS_VALID; } 124 125 /** 126 * Returns true if the word is of the specified class 127 */ isWordClass(WordClass wordClass)128 bool isWordClass(WordClass wordClass) const { 129 return _wordP && _wordP->isClass(wordClass); 130 } 131 setFlag(bool val)132 void setFlag(bool val) { _flag = val; } set1C(int val)133 void set1C(int val) { _field1C = val; } get20()134 int get20() const { return _field20; } getState()135 int getState() const { return _field34; } 136 137 bool checkWordId1() const; 138 bool checkWordId2() const; 139 bool checkWordId3() const; 140 bool checkWordClass() const; 141 142 /** 143 * Return text assocaited with the concept's word or script 144 */ 145 const TTstring getText(); 146 147 /** 148 * Find a word by Id 149 */ 150 TTconcept *findByWordId(int id); 151 152 /** 153 * Find a word by it's class 154 */ 155 TTconcept *findByWordClass(WordClass wordClass); 156 157 TTconcept *findBy20(int val); 158 159 /** 160 * Returns true if the concept has a word with a given Id 161 */ 162 bool isTheWordId(int id) const; 163 164 /** 165 * If a word is associated, return it's Id 166 */ 167 int getTheWordId() const; 168 }; 169 170 extern bool isWordId(const TTconcept *concept, int id); 171 172 extern int getWordId(const TTconcept *concept); 173 174 } // End of namespace Titanic 175 176 #endif /* TITANIC_TT_CONCEPT_H */ 177