2012-01-06 23:29:45 +01:00
|
|
|
/* ResidualVM - A 3D game interpreter
|
2008-06-13 14:57:47 +00:00
|
|
|
*
|
2012-01-06 23:29:45 +01:00
|
|
|
* ResidualVM is the legal property of its developers, whose names
|
2012-12-19 23:15:43 +01:00
|
|
|
* are too numerous to list here. Please refer to the AUTHORS
|
2008-06-13 14:57:47 +00:00
|
|
|
* file distributed with this source distribution.
|
2006-04-02 14:20:45 +00:00
|
|
|
*
|
2012-12-19 23:15:43 +01:00
|
|
|
* 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.
|
2014-04-05 18:18:42 +02:00
|
|
|
*
|
2012-12-19 23:15:43 +01:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
2006-04-02 14:20:45 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2012-12-19 23:15:43 +01:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2014-04-05 18:18:42 +02:00
|
|
|
*
|
2012-12-19 23:15:43 +01:00
|
|
|
* 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.
|
2006-04-02 14:20:45 +00:00
|
|
|
*
|
|
|
|
*/
|
2003-08-22 05:53:29 +00:00
|
|
|
|
2009-05-26 09:39:42 +00:00
|
|
|
#ifndef GRIM_TEXTOBJECT_H
|
|
|
|
#define GRIM_TEXTOBJECT_H
|
2003-08-22 05:53:29 +00:00
|
|
|
|
2011-09-07 23:08:59 +02:00
|
|
|
#include "engines/grim/pool.h"
|
2012-01-27 11:47:28 -08:00
|
|
|
#include "engines/grim/color.h"
|
2005-01-01 12:27:57 +00:00
|
|
|
|
2012-03-26 20:12:00 -07:00
|
|
|
#include "common/endian.h"
|
|
|
|
|
2009-05-25 06:49:57 +00:00
|
|
|
namespace Grim {
|
|
|
|
|
2009-06-23 05:15:20 +00:00
|
|
|
class SaveGame;
|
2011-05-13 17:55:14 -07:00
|
|
|
class Font;
|
2009-06-23 05:15:20 +00:00
|
|
|
|
2011-05-18 09:03:17 +08:00
|
|
|
class TextObjectCommon {
|
|
|
|
public:
|
2014-07-31 15:50:08 -04:00
|
|
|
void setX(int x) { _x = x; }
|
2012-05-05 18:08:47 -07:00
|
|
|
int getX() const { return _x; }
|
2011-05-18 09:03:17 +08:00
|
|
|
|
2014-07-31 15:50:08 -04:00
|
|
|
void setY(int y) { _y = y; }
|
2012-05-05 18:08:47 -07:00
|
|
|
int getY() const { return _y; }
|
2011-05-18 09:03:17 +08:00
|
|
|
|
2013-10-25 07:40:30 -07:00
|
|
|
void setFont(const Font *font) { _font = font; }
|
2012-05-05 18:08:47 -07:00
|
|
|
const Font *getFont() const { return _font; }
|
2011-05-18 09:03:17 +08:00
|
|
|
|
2012-01-27 11:47:28 -08:00
|
|
|
void setFGColor(const Color &fgColor) { _fgColor = fgColor; }
|
2012-05-05 18:08:47 -07:00
|
|
|
Color getFGColor() const { return _fgColor; }
|
2011-05-18 09:03:17 +08:00
|
|
|
|
|
|
|
void setJustify(int justify) { _justify = justify; }
|
2012-05-05 18:08:47 -07:00
|
|
|
int getJustify() const { return _justify; }
|
2011-05-18 09:03:17 +08:00
|
|
|
|
|
|
|
void setWidth(int width) { _width = width; }
|
2012-05-05 18:08:47 -07:00
|
|
|
int getWidth() const { return _width; }
|
2011-05-18 09:03:17 +08:00
|
|
|
|
|
|
|
void setHeight(int height) { _height = height; }
|
2012-05-05 18:08:47 -07:00
|
|
|
int getHeight() const { return _height; }
|
2011-05-18 09:03:17 +08:00
|
|
|
|
2011-05-22 19:46:59 +02:00
|
|
|
void setDuration(int duration) { _duration = duration; }
|
|
|
|
int getDuration() const { return _duration; }
|
|
|
|
|
2013-11-25 23:54:20 +01:00
|
|
|
void setLayer(int layer);
|
|
|
|
int getLayer() const { return _layer; }
|
|
|
|
|
2015-02-03 19:49:47 -08:00
|
|
|
void setCoords(int coords) { _coords = coords; }
|
|
|
|
int getCoords() const { return _coords; }
|
|
|
|
|
2011-05-18 09:03:17 +08:00
|
|
|
protected:
|
|
|
|
TextObjectCommon();
|
|
|
|
|
2013-07-07 21:07:23 -07:00
|
|
|
const Font *_font;
|
2011-05-18 09:03:17 +08:00
|
|
|
int _x, _y;
|
|
|
|
int _width, _height;
|
|
|
|
int _justify;
|
2011-05-22 19:46:59 +02:00
|
|
|
int _duration;
|
2013-11-25 23:54:20 +01:00
|
|
|
int _layer;
|
2015-02-03 19:49:47 -08:00
|
|
|
int _coords;
|
2013-07-07 21:07:23 -07:00
|
|
|
Color _fgColor;
|
2011-05-18 09:03:17 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class TextObjectDefaults : public TextObjectCommon {
|
|
|
|
|
2005-03-20 16:48:26 +00:00
|
|
|
};
|
|
|
|
|
2012-04-05 15:20:30 -07:00
|
|
|
class TextObject : public PoolObject<TextObject>,
|
2021-04-15 21:20:04 +02:00
|
|
|
public TextObjectCommon {
|
2004-02-25 08:21:31 +00:00
|
|
|
public:
|
2011-03-21 05:16:27 +08:00
|
|
|
TextObject();
|
2005-03-19 21:48:23 +00:00
|
|
|
~TextObject();
|
2011-05-22 22:31:27 -07:00
|
|
|
|
2012-04-05 15:20:30 -07:00
|
|
|
static int32 getStaticTag() { return MKTAG('T', 'E', 'X', 'T'); }
|
|
|
|
|
2013-10-25 07:40:30 -07:00
|
|
|
void setDefaults(const TextObjectDefaults *defaults);
|
2014-07-22 18:23:34 -04:00
|
|
|
void setText(const Common::String &text, bool delaySetup);
|
2011-07-25 23:42:07 +02:00
|
|
|
void reset();
|
2011-05-18 09:03:17 +08:00
|
|
|
|
2012-05-05 18:08:47 -07:00
|
|
|
int getBitmapWidth() const;
|
|
|
|
int getBitmapHeight() const;
|
2005-04-05 04:33:56 +00:00
|
|
|
int getTextCharPosition(int pos);
|
2003-08-22 05:53:29 +00:00
|
|
|
|
2012-05-05 18:08:47 -07:00
|
|
|
int getLineX(int line) const;
|
|
|
|
int getLineY(int line) const;
|
2011-05-23 16:19:47 -07:00
|
|
|
|
2013-10-25 06:41:29 -07:00
|
|
|
void setIsSpeech() { _isSpeech = true; }
|
2013-10-24 17:52:28 -07:00
|
|
|
void setBlastDraw() { _blastDraw = true; }
|
2014-01-17 09:48:06 -08:00
|
|
|
bool isBlastDraw() { return _blastDraw; }
|
2013-10-24 17:52:28 -07:00
|
|
|
|
2012-05-05 18:08:47 -07:00
|
|
|
const void *getUserData() const { return _userData; }
|
2011-05-23 22:00:53 -07:00
|
|
|
void setUserData(void *data) { _userData = data; }
|
|
|
|
|
2012-05-05 18:08:47 -07:00
|
|
|
const Common::String *getLines() const { return _lines; }
|
|
|
|
int getNumLines() const { return _numberLines; }
|
2011-05-23 16:19:47 -07:00
|
|
|
|
2011-07-25 17:06:24 +02:00
|
|
|
const Common::String &getName() const { return _textID; }
|
2005-03-19 21:48:23 +00:00
|
|
|
void draw();
|
2011-05-22 19:46:59 +02:00
|
|
|
void update();
|
2003-08-22 05:53:29 +00:00
|
|
|
|
2011-06-07 09:20:10 -07:00
|
|
|
void destroy();
|
|
|
|
|
2011-03-21 17:18:04 +01:00
|
|
|
void saveState(SaveGame *state) const;
|
|
|
|
bool restoreState(SaveGame *state);
|
2011-03-21 05:16:27 +08:00
|
|
|
|
2013-12-01 17:40:16 +01:00
|
|
|
int getStackLevel() { return _stackLevel; }
|
|
|
|
void incStackLevel() { _stackLevel++; }
|
|
|
|
void decStackLevel() { assert(_stackLevel > 0); _stackLevel--; }
|
|
|
|
|
2005-03-20 13:51:40 +00:00
|
|
|
enum Justify {
|
|
|
|
NONE,
|
|
|
|
CENTER,
|
2005-04-05 13:50:54 +00:00
|
|
|
LJUSTIFY,
|
|
|
|
RJUSTIFY
|
2005-03-20 13:51:40 +00:00
|
|
|
};
|
|
|
|
|
2004-02-25 08:21:31 +00:00
|
|
|
protected:
|
2011-05-22 22:31:27 -07:00
|
|
|
void setupText();
|
2013-07-10 12:09:06 -07:00
|
|
|
|
2011-07-25 17:06:24 +02:00
|
|
|
Common::String _textID;
|
2013-07-10 12:09:06 -07:00
|
|
|
|
2011-05-22 22:31:27 -07:00
|
|
|
Common::String *_lines;
|
2013-07-10 12:09:06 -07:00
|
|
|
|
2011-05-23 22:00:53 -07:00
|
|
|
void *_userData;
|
2013-07-10 12:09:06 -07:00
|
|
|
|
|
|
|
int _numberLines;
|
|
|
|
int _elapsedTime;
|
|
|
|
int _maxLineWidth;
|
|
|
|
|
|
|
|
bool _blastDraw;
|
|
|
|
bool _isSpeech;
|
|
|
|
bool _created;
|
2013-12-01 17:40:16 +01:00
|
|
|
|
|
|
|
int _stackLevel;
|
2003-08-22 05:53:29 +00:00
|
|
|
};
|
2005-03-19 21:48:23 +00:00
|
|
|
|
2009-05-25 06:49:57 +00:00
|
|
|
} // end of namespace Grim
|
|
|
|
|
2003-08-22 05:53:29 +00:00
|
|
|
#endif
|