ScummVM API documentation
subtitle.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 LASTEXPRESS_SOUND_SUBTITLE_H
23 #define LASTEXPRESS_SOUND_SUBTITLE_H
24 
25 #include "lastexpress/shared.h"
26 #include "lastexpress/sound/slot.h"
27 
28 namespace LastExpress {
29 
30 class LastExpressEngine;
31 class Slot;
32 struct FontData;
33 
34 typedef uint16 PixMap;
35 
36 class Subtitle {
37  friend class Slot;
38  friend class LastExpressEngine;
39  friend class SubtitleManager;
40 
41 public:
42  Subtitle(LastExpressEngine *engine, const char *filename, Slot *slot);
43  ~Subtitle();
44  void load();
45  void update();
46  void kill();
47 
48 protected:
49  LastExpressEngine *_engine = nullptr;
50  char _filename[24]; // Originally 12 bytes, but it constantly overflows...
51  int _status = 0;
52  Slot *_slot = nullptr;
53  uint16 *_data = nullptr;
54  Subtitle *_next = nullptr;
55 };
56 
58  friend class Subtitle;
59  friend class MemoryManager;
60  friend class GraphicsManager;
61 
62 public:
64  ~SubtitleManager();
65 
66  void initSubtitles();
67  void storeVArea(PixMap *pixels);
68  void restoreVArea(PixMap *pixels);
69  void vSubOn();
70  void vSubOff();
71  void clearSubArea();
72  void drawChar(PixMap *destBuf, uint8 whichChar);
73  void drawSubArea(uint16 *subtitleData);
74  void subThread();
75 
76 private:
77  LastExpressEngine *_engine = nullptr;
78 
79  uint16 *_subtitlesData = nullptr;
80  Subtitle *_subtitlesQueue = nullptr;
81  Subtitle *_currentSubtitle = nullptr;
82  int32 _flags = 0;
83  int32 _subtitleIndex = 0;
84  int32 _lowerLineXStart = 0;
85  int32 _upperLineXStart = 0;
86  int32 _upperLineCharWidths[60];
87  int32 _lowerLineCharWidths[60];
88  int16 _upperLineChars[60];
89  int16 _lowerLineChars[60];
90  int32 _upperLineLength = 0;
91  int32 _lowerLineLength = 0;
92  FontData *_font = nullptr;
93 };
94 
95 } // End of namespace LastExpress
96 
97 #endif // LASTEXPRESS_SOUND_SUBTITLE_H
Definition: subtitle.h:57
Definition: lastexpress.h:523
Definition: lastexpress.h:463
Definition: archive.h:29
Definition: memory.h:63
Definition: graphics.h:64
Definition: slot.h:66
Definition: subtitle.h:36