ScummVM API documentation
autotext.h
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 modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (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, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef NANCY_ACTION_AUTOTEXT_H
23 #define NANCY_ACTION_AUTOTEXT_H
24 
25 #include "engines/nancy/misc/hypertext.h"
26 #include "engines/nancy/action/actionrecord.h"
27 
28 namespace Nancy {
29 namespace Action {
30 
31 // Blits a filled viewport autotext surface (ids 0-2) on top of the scene
32 // background. Nancy 10+ spawns an Overlay for this; we render it directly.
33 class AutotextRender : public RenderObject {
34 public:
35  AutotextRender(uint16 zOrder) : RenderObject(zOrder) {}
36  virtual ~AutotextRender() {}
37 
38  bool isViewportRelative() const override { return true; }
39 };
40 
41 // Action record used for rendering text inside the game viewport.
42 // Can be used in two ways: for single-use texts that get thrown away
43 // after a scene change, or for permanent storage (used in nancy's journal)
44 // Draws to a surface inside GraphicsManager, which other ActionRecords
45 // (Overlay and PeepholePuzzle) can use. For viewport surfaces (ids 0-2) it
46 // also blits that surface onscreen itself, via an owned AutotextRender.
47 class Autotext : public virtual ActionRecord, public Misc::HypertextParser {
48 public:
49  Autotext() {}
50  virtual ~Autotext() { delete _viewportRender; }
51 
52  void readData(Common::SeekableReadStream &stream) override;
53  void execute() override;
54 
55 protected:
56  Common::String getRecordTypeName() const override { return "Autotext"; }
57 
58  virtual void readExtraData(Common::SeekableReadStream &stream);
59 
60  uint16 _transparency = kPlayOverlayPlain;
61  uint16 _surfaceID = 0;
62  uint16 _fontID = 0;
63  uint16 _textColor = 0;
64  Common::Point _offset;
65  uint16 _surfWidth = 0;
66  uint16 _surfHeight = 0;
67 
68  bool _useAutotextChunk = false;
69 
70  // Only one of these can be valid
71  Common::String _textKey;
72  Common::String _embeddedText;
73 
74  uint16 _order = kListFIFO;
75  bool _shouldDrawMarks = false;
76 
77  Common::Array<uint16> _hotspotScenes;
78 
79  // Nancy 10+ placement descriptor for viewport surfaces (0-2).
80  // Absent from TextScroll records, which place themselves.
81  bool _hasPlacementDescriptor = true;
82  uint16 _placementMode = 0;
83  Common::Rect _viewportDest;
84  Common::Rect _viewportSrc;
85 
86  // Set to false by subclasses (TextScroll) that handle their own display
87  bool _selfDisplay = true;
88  AutotextRender *_viewportRender = nullptr;
89 
91 };
92 
93 } // End of namespace Action
94 } // End of namespace Nancy
95 
96 #endif // NANCY_ACTION_AUTOTEXT_H
Definition: managed_surface.h:51
Definition: str.h:59
Definition: autotext.h:33
Definition: rect.h:536
Definition: stream.h:745
Definition: hypertext.h:32
Definition: renderobject.h:36
Definition: autotext.h:47
Definition: actionrecord.h:98
Definition: rect.h:144
Definition: actionmanager.h:32