ScummVM API documentation
picture.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 AGI_PICTURE_H
23 #define AGI_PICTURE_H
24 
25 namespace Agi {
26 
27 #define _DEFAULT_WIDTH 160
28 #define _DEFAULT_HEIGHT 168
29 
33 struct AgiPicture {
34  uint32 flen;
35  uint8 *rdata;
37  void reset() {
38  flen = 0;
39  rdata = nullptr;
40  }
41 
42  AgiPicture() { reset(); }
43 };
44 
45 // AGI picture version
46 enum AgiPictureVersion {
47  AGIPIC_C64,
48  AGIPIC_V1,
49  AGIPIC_V15,
50  AGIPIC_V2,
51  AGIPIC_256
52 };
53 
54 enum AgiPictureFlags {
55  kPicFNone = (1 << 0),
56  kPicFCircle = (1 << 1),
57  kPicFStep = (1 << 2),
58  kPicFf3Stop = (1 << 3),
59  kPicFf3Cont = (1 << 4),
60  kPicFTrollMode = (1 << 5)
61 };
62 
63 class AgiBase;
64 class GfxMgr;
65 
66 class PictureMgr {
67  AgiBase *_vm;
68  GfxMgr *_gfx;
69 
70 public:
71  PictureMgr(AgiBase *agi, GfxMgr *gfx);
72 
73  int16 getResourceNr() { return _resourceNr; };
74 
75 private:
76  void draw_xCorner(bool skipOtherCoords = false);
77  void yCorner(bool skipOtherCoords = false);
78  void plotBrush();
79 
80  byte getNextByte();
81  bool getNextParamByte(byte &b);
82  byte getNextNibble();
83 
84 public:
85  void putVirtPixel(int x, int y);
86 
87  int decodePicture(int16 resourceNr, bool clearScreen, bool agi256 = false, int16 pic_width = _DEFAULT_WIDTH, int16 pic_height = _DEFAULT_HEIGHT);
88  int decodePicture(byte *data, uint32 length, int clear, int pic_width = _DEFAULT_WIDTH, int pic_height = _DEFAULT_HEIGHT);
89  void unloadPicture(int picNr);
90  void drawPicture();
91 private:
92  void drawPictureC64();
93  void drawPictureV1();
94  void drawPictureV15();
95  void drawPictureV2();
96  void drawPictureAGI256();
97 
98  void draw_SetColor();
99  void draw_SetPriority();
100  void draw_SetNibbleColor();
101  void draw_SetNibblePriority();
102 
103  void draw_Line(int16 x1, int16 y1, int16 x2, int16 y2);
104  void draw_LineShort();
105  void draw_LineAbsolute();
106 
107  int draw_FillCheck(int16 x, int16 y);
108  void draw_Fill(int16 x, int16 y);
109  void draw_Fill();
110 
111 public:
112  void showPic(); // <-- for regular AGI games
113  void showPic(int16 x, int16 y, int16 pic_width, int16 pic_height); // <-- for preAGI games
114  void showPicWithTransition();
115 
116  void plotPattern(int x, int y); // public because it's used directly by preagi
117 
118  void setPattern(uint8 code, uint8 num);
119 
120  void setPictureVersion(AgiPictureVersion version);
121  void setPictureData(uint8 *data, int len = 4096);
122 
123  void setPictureFlags(int flags) { _flags = flags; }
124 
125  void clear();
126 
127  void setOffset(int offX, int offY) {
128  _xOffset = offX;
129  _yOffset = offY;
130  }
131 
132  void setDimensions(int w, int h) {
133  _width = w;
134  _height = h;
135  }
136 
137 private:
138  int16 _resourceNr;
139  uint8 *_data;
140  uint32 _dataSize;
141  uint32 _dataOffset;
142  bool _dataOffsetNibble;
143 
144  uint8 _patCode;
145  uint8 _patNum;
146  uint8 _priOn;
147  uint8 _scrOn;
148  uint8 _scrColor;
149  uint8 _priColor;
150 
151  uint8 _minCommand;
152 
153  AgiPictureVersion _pictureVersion;
154  int16 _width, _height;
155  int16 _xOffset, _yOffset;
156 
157  int _flags;
158  int _currentStep;
159 };
160 
161 } // End of namespace Agi
162 
163 #endif /* AGI_PICTURE_H */
Definition: agi.h:704
Definition: picture.h:66
uint8 * rdata
Definition: picture.h:35
Definition: graphics.h:58
uint32 flen
Definition: picture.h:34
Definition: picture.h:33
Definition: agi.h:63