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 ASYLUM_SYSTEM_SPEECH_H 24 #define ASYLUM_SYSTEM_SPEECH_H 25 26 #include "common/scummsys.h" 27 28 #include "asylum/shared.h" 29 30 namespace Asylum { 31 32 class AsylumEngine; 33 34 class Speech { 35 public: 36 Speech(AsylumEngine *engine); ~Speech()37 ~Speech() {}; 38 39 /** 40 * Play speech 41 * 42 * @param soundResourceId The sound resource id. 43 * @param textResourceId The text resource id. 44 */ 45 ResourceId play(ResourceId soundResourceId, ResourceId textResourceId); 46 47 /** 48 * Prepare speech to play 49 * - Process sound speech and draws dialog in screen 50 */ 51 void prepareSpeech(); 52 53 /** 54 * Play speech by index offset. 55 * 56 * @param index The index offset. 57 * 58 * @return the ResourceId for the sound played 59 */ 60 ResourceId playIndexed(int32 index); 61 62 /** 63 * Play scene speech. 64 * 65 * @param type The type of speech to play. 66 * @param index The index offset. 67 * 68 * @return the ResourceId for the sound played 69 */ 70 ResourceId playScene(int32 type, int32 index); 71 72 /** 73 * Play speech by index offset (based on player type) 74 * 75 * @param index The index offset. 76 * 77 * @return the ResourceId for the sound played 78 */ 79 ResourceId playPlayer(int32 index); 80 81 /** 82 * Resets the resource identifiers. 83 */ 84 void resetResourceIds(); 85 86 /** 87 * Resets text data 88 */ 89 void resetTextData(); 90 91 /** 92 * Gets the sound resource identifier. 93 * 94 * @return The sound resource identifier. 95 */ getSoundResourceId()96 ResourceId getSoundResourceId() const { return _soundResourceId; } 97 98 /** 99 * Sets the tick. 100 * 101 * @param val The value. 102 */ setTick(int32 val)103 void setTick(int32 val) { _tick = val;} 104 105 /** 106 * Gets the tick. 107 * 108 * @return The tick. 109 */ getTick()110 uint32 getTick() { return _tick; } 111 112 /** 113 * Sets the sound resource identifier 114 * 115 * @param id The sound resource identifier. 116 */ setSoundResourceId(ResourceId id)117 void setSoundResourceId(ResourceId id) { _soundResourceId = id; } 118 119 /** 120 * Sets the text resource identifier 121 * 122 * @param id The text resource identifier. 123 */ setTextResourceId(ResourceId id)124 void setTextResourceId(ResourceId id) { _textResourceId = id; } 125 126 /** 127 * Gets the text resource identifier. 128 * 129 * @return The text resource identifier. 130 */ getTextResourceId()131 ResourceId getTextResourceId() { return _textResourceId; } 132 133 /** 134 * Sets text data. 135 * 136 * @param text The text. 137 */ setTextData(char * text)138 void setTextData(char *text) { _textData = text; } 139 140 /** 141 * Get text data 142 * 143 * @return the text data 144 */ getTextData()145 char *getTextData() { return _textData; } 146 147 /** 148 * Sets text data position. 149 * 150 * @param text The text. 151 */ setTextDataPos(char * text)152 void setTextDataPos(char *text) { _textDataPos = text; } 153 154 /** 155 * Get text data position 156 * 157 * @return the text data position 158 */ getTextDataPos()159 char *getTextDataPos() { return _textDataPos; } 160 161 private: 162 AsylumEngine *_vm; 163 164 int32 _tick; 165 char *_textData; 166 char *_textDataPos; 167 168 ResourceId _soundResourceId; 169 ResourceId _textResourceId; 170 171 /** 172 * Process speech and prepare for display 173 */ 174 void process(); 175 176 }; 177 178 } // end of namespace Asylum 179 180 #endif // ASYLUM_SYSTEM_SPEECH_H 181