ScummVM API documentation
wsamovie.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 KYRA_WSAMOVIE_H
23 #define KYRA_WSAMOVIE_H
24 
25 #include "kyra/kyra_v1.h"
26 
27 namespace Kyra {
28 
29 class Palette;
30 
31 class Movie {
32 public:
33  Movie(KyraEngine_v1 *vm) : _vm(vm), _screen(vm->screen()), _opened(false), _x(-1), _y(-1), _drawPage(-1) {}
34  virtual ~Movie() {}
35 
36  virtual bool opened() { return _opened; }
37 
38  virtual int xAdd() const { return 0; }
39  virtual int yAdd() const { return 0; }
40 
41  virtual int width() const = 0;
42  virtual int height() const = 0;
43 
44  virtual int open(const char *filename, int offscreen, Palette *palette) = 0;
45  virtual void close() = 0;
46 
47  virtual int frames() = 0;
48 
49  virtual void displayFrame(int frameNum, int pageNum, int x, int y, uint16 flags, const uint8 *table1, const uint8 *table2) = 0;
50 
51 protected:
52  KyraEngine_v1 *_vm;
53  Screen *_screen;
54  bool _opened;
55 
56  int _x, _y;
57  int _drawPage;
58 };
59 
60 class WSAMovie_v1 : public Movie {
61 public:
63  ~WSAMovie_v1() override;
64 
65  int width() const override { return _width; }
66  int height() const override { return _height; }
67 
68  int open(const char *filename, int offscreen, Palette *palette) override;
69  void close() override;
70 
71  int frames() override { return _opened ? _numFrames : -1; }
72 
73  void displayFrame(int frameNum, int pageNum, int x, int y, uint16 flags, const uint8 *table1, const uint8 *table2) override;
74 
75  enum WSAFlags {
76  WF_OFFSCREEN_DECODE = 0x10,
77  WF_NO_LAST_FRAME = 0x20,
78  WF_NO_FIRST_FRAME = 0x40,
79  WF_FLIPPED = 0x80,
80  WF_HAS_PALETTE = 0x100,
81  WF_XOR = 0x200
82  };
83 
84 protected:
85  virtual void processFrame(int frameNum, uint8 *dst);
86 
87  uint16 _currentFrame;
88  uint16 _numFrames;
89  uint16 _width;
90  uint16 _height;
91  uint16 _flags;
92  uint8 *_deltaBuffer;
93  uint32 _deltaBufferSize;
94  uint8 *_offscreenBuffer;
95  uint32 *_frameOffsTable;
96  uint8 *_frameData;
97 };
98 
99 class WSAMovieAmiga : public WSAMovie_v1 {
100 public:
102  int open(const char *filename, int offscreen, Palette *palette) override;
103  void close() override;
104 
105  void displayFrame(int frameNum, int pageNum, int x, int y, uint16 flags, const uint8 *table1, const uint8 *table2) override;
106 private:
107  void processFrame(int frameNum, uint8 *dst) override;
108 
109  uint8 *_buffer;
110 };
111 
112 class WSAMovie_v2 : public WSAMovie_v1 {
113 public:
115 
116  int open(const char *filename, int unk1, Palette *palette) override;
117  void displayFrame(int frameNum, int pageNum, int x, int y, uint16 flags, const uint8 *table1, const uint8 *table2) override {
118  WSAMovie_v1::displayFrame(frameNum, pageNum, x + _xAdd, y + _yAdd, flags, table1, table2);
119  }
120 
121  int xAdd() const override { return _xAdd; }
122  int yAdd() const override { return _yAdd; }
123 
124  void setWidth(int w) { _width = w; }
125  void setHeight(int h) { _height = h; }
126 protected:
127  int16 _xAdd;
128  int16 _yAdd;
129 };
130 
131 } // End of namespace Kyra
132 
133 #endif
Definition: wsamovie.h:60
Definition: kyra_v1.h:126
Definition: screen.h:565
Definition: wsamovie.h:99
Definition: wsamovie.h:31
Definition: screen.h:444
Definition: detection.h:27
Definition: wsamovie.h:112
Definition: atari-screen.h:44