1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254
|
/* 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 TSAGE_CONVERSE_H
#define TSAGE_CONVERSE_H
#include "tsage/core.h"
#include "tsage/dialogs.h"
#include "tsage/sound.h"
namespace TsAGE {
class StripCallback : public Action {
public:
virtual void stripCallback(int v) = 0;
};
typedef void (*SequenceCallback)(int v1, int v2);
class SequenceManager : public Action {
private:
void setup();
uint16 getNextValue();
void setMessage(int resNum, int lineNum, int color, const Common::Point &pt, int width);
void setMessage(int resNum, int lineNum, int fontNum, int color1, int color2, int color3,
const Common::Point &pt, int width);
SequenceManager *globalManager();
public:
SceneText _sceneText;
int _resNum;
uint _sequenceOffset;
bool _keepActive;
int _fontNum;
int _field26;
Common::Array<byte> _sequenceData;
int _objectIndex;
SceneObject *_sceneObject;
SceneObject *_objectList[6];
ASound _soundHandler;
SequenceCallback _onCallback;
public:
SequenceManager();
virtual Common::String getClassName() { return "SequenceManager"; }
virtual void synchronize(Serializer &s);
virtual void remove();
virtual void signal();
virtual void process(Event &event);
virtual void attached(EventHandler *newOwner, EventHandler *endHandler, va_list va);
};
class Speaker : public EventHandler {
public:
Rect _fieldA;
Action *_field18;
Common::String _speakerName;
int _newSceneNumber;
int _oldSceneNumber;
SceneObjectList _objectList;
Rect _sceneBounds;
SceneText _sceneText;
int _textWidth;
Common::Point _textPos;
int _fontNumber;
TextAlign _textMode;
int _color1, _color2, _color3;
bool _hideObjects;
public:
Speaker();
virtual Common::String getClassName() { return "Speaker"; }
virtual void synchronize(Serializer &s);
virtual void remove();
virtual void startSpeaking(Action *action);
virtual void setText(const Common::String &msg);
virtual void removeText();
virtual void stopSpeaking() {}
void setTextPos(const Common::Point &pt) { _textPos = pt; }
};
class SpeakerGameText : public Speaker {
public:
SpeakerGameText();
virtual Common::String getClassName() { return "SpeakerGameText"; }
};
class ScreenSpeaker : public Speaker {
public:
SceneItem *_npc;
public:
ScreenSpeaker();
virtual Common::String getClassName() { return "ScreenSpeaker"; }
virtual void setText(const Common::String &msg);
};
class SpeakerAction : public Action {
public:
virtual void signal();
virtual Common::String getClassName() { return "SpeakerAction"; }
};
class AnimatedSpeaker : public Speaker {
public:
SceneObject _object1;
SceneObject _object2;
SpeakerAction _speakerAction;
public:
virtual Common::String getClassName() { return "AnimatedSpeaker"; }
virtual void removeText();
};
class ChoiceEntry {
public:
Common::String _msg;
Rect _bounds;
ChoiceEntry() {}
ChoiceEntry(const Common::String &msg, const Rect &bounds) {
_msg = msg;
_bounds = bounds;
}
};
class ConversationChoiceDialog : public ModalDialog {
private:
int textLeft() const;
int textMaxWidth() const;
int numberLeft() const;
public:
int _stdColor;
int _highlightColor;
int _fontNumber;
int _savedFgColor;
int _savedFontNumber;
Common::Array<ChoiceEntry> _choiceList;
uint _selectedIndex;
public:
ConversationChoiceDialog();
void setColors(int stdColor, int highlightColor) {
_stdColor = stdColor;
_highlightColor = highlightColor;
}
void setFontNumber(int fontNum) { _fontNumber = fontNum; }
int execute(const Common::StringArray &choiceList);
virtual void draw();
};
class Obj0A : public Serialisable {
public:
int _id;
uint _scriptOffset;
virtual void synchronize(Serializer &s) {
s.syncAsSint32LE(_id);
s.syncAsUint32LE(_scriptOffset);
}
};
#define OBJ44_LIST_SIZE 5
#define OBJ0A_LIST_SIZE ((g_vm->getGameID() == GType_Ringworld2) ? 8 : 5)
class Obj44 : public Serialisable {
public:
int _id;
int _callbackId[OBJ44_LIST_SIZE];
Obj0A _list[8];
uint _speakerOffset;
// Return to Ringworld specific field
int _mode;
int _lookupValue, _lookupIndex, _exitMode;
int _speakerMode;
int _field16[11];
public:
void load(const byte *dataP);
virtual void synchronize(Serializer &s);
};
typedef void (*StripProc)();
class StripManager : public Action {
private:
void reset();
void load();
Speaker *getSpeaker(const char *speakerName);
int getNewIndex(int newId);
public:
int _stripNum;
int _obj44ListIndex;
int _useless;
int _sceneNumber;
Rect _sceneBounds;
ConversationChoiceDialog _choiceDialog;
Common::Array<Speaker *> _speakerList;
StripCallback *_callbackObject;
Speaker *_activeSpeaker;
bool _textShown;
bool _uselessFl;
int _currObj44Id;
int _exitMode;
Common::Array<Obj44> _obj44List;
Common::Array<byte> _script;
StripProc _onBegin;
StripProc _onEnd;
// Ringworld 2 specific fields
byte *_lookupList;
public:
StripManager();
virtual ~StripManager();
virtual void synchronize(Serializer &s);
virtual void remove();
virtual void dispatch();
virtual void signal();
virtual void process(Event &event);
void start(int stripNum, EventHandler *owner, StripCallback *callback = NULL);
void start3(int stripNum, EventHandler *owner, byte *lookupList);
void setCallback(StripCallback *callback) { _callbackObject = callback; }
void setColors(int stdColor, int highlightColor) { _choiceDialog.setColors(stdColor, highlightColor); }
void setFontNumber(int fontNum) { _choiceDialog.setFontNumber(fontNum); }
void addSpeaker(Speaker *speaker);
};
} // End of namespace TsAGE
#endif
|