ScummVM API documentation
gr_series.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 M4_GRAPHICS_GR_SERIES_H
23 #define M4_GRAPHICS_GR_SERIES_H
24 
25 #include "m4/m4_types.h"
26 #include "m4/wscript/ws_machine.h"
27 
28 namespace M4 {
29 
30 constexpr uint32 SERIES_FORWARD = 0;
31 constexpr uint32 SERIES_PINGPONG = 1;
32 constexpr uint32 SERIES_BACKWARD = 2;
33 constexpr uint32 SERIES_RANDOM = 4; // series is played in random order, trigger after number of frames in range played
34 constexpr uint32 SERIES_NO_TOSS = 8; // series is not tossed at the end of playing
35 constexpr uint32 SERIES_STICK = 16; // series sticks on last frame, then sends trigger
36 constexpr uint32 SERIES_LOOP_TRIGGER = 32; // get trigger back every loop
37 constexpr uint32 SERIES_LOAD_PALETTE = 64; // load master_palette with colours?
38 constexpr uint32 SERIES_HORZ_FLIP = 128; // horizontal flip
39 
40 enum {
41  HASH_SERIES_PLAY_MACHINE = 0,
42  HASH_SERIES_SHOW_MACHINE = 1,
43  HASH_STREAM_MACHINE = 6
44 };
45 
49 struct Series {
50  machine *_series = nullptr;
51  machine *_seriesS = nullptr;
52 
53  void play(const char *seriesName, frac16 layer, uint32 flags = 0,
54  int16 triggerNum = -1, int32 frameRate = 6, int32 loopCount = 0, int32 s = 100,
55  int32 x = 0, int32 y = 0, int32 firstFrame = 0, int32 lastFrame = -1);
56  void show(const char *seriesName, frac16 layer, uint32 flags = 0,
57  int16 triggerNum = -1, int32 duration = -1, int32 index = 0, int32 s = 100,
58  int32 x = 0, int32 y = 0);
59  void show(const char *series1, const char *series2, int layer);
60  void terminate();
61 
62  operator bool() const {
63  return _series != nullptr;
64  }
65 
66  machine *&operator[](uint idx) {
67  return (idx == 0) ? _series : _seriesS;
68  }
69 
70  frac16 *regs() const {
71  return _series->myAnim8->myRegs;
72  }
73 
74  static void series_play(const char *seriesName, frac16 layer, uint32 flags = 0,
75  int16 triggerNum = -1, int32 frameRate = 6, int32 loopCount = 0, int32 s = 100,
76  int32 x = 0, int32 y = 0, int32 firstFrame = 0, int32 lastFrame = -1);
77  static void series_show(const char *seriesName, frac16 layer, uint32 flags = 0,
78  int16 triggerNum = -1, int32 duration = -1, int32 index = 0, int32 s = 100,
79  int32 x = 0, int32 y = 0);
80 };
81 
82 int32 series_load(const char *seriesName, int32 assetIndex = -1, RGB8 *myPal = nullptr);
83 void series_unload(int32 assetIndex);
84 bool series_draw_sprite(int32 spriteHash, int32 index, Buffer *destBuff, int32 x, int32 y);
85 
86 bool series_show_frame(int32 spriteHash, int32 index, Buffer *destBuff, int32 x, int32 y);
87 machine *series_place_sprite(const char *seriesName, int32 index, int32 x, int32 y, int32 s, int32 layer);
88 machine *series_show_sprite(const char *seriesName, int32 index, int32 layer);
89 
90 machine *series_play(const char *seriesName, frac16 layer, uint32 flags = 0,
91  int16 triggerNum = -1, int32 frameRate = 6, int32 loopCount = 0, int32 s = 100,
92  int32 x = 0, int32 y = 0, int32 firstFrame = 0, int32 lastFrame = -1);
93 machine *series_simple_play(const char *seriesName, frac16 layer, bool stickWhenDone);
94 
95 machine *series_show(const char *seriesName, frac16 layer, uint32 flags = 0,
96  int16 triggerNum = -1, int32 duration = -1, int32 index = 0, int32 s = 100,
97  int32 x = 0, int32 y = 0);
98 
99 machine *series_ranged_play(const char *seriesName, int32 loopCount, uint32 flags,
100  int32 firstFrame, int32 lastFrame, int32 s, uint32 layer,
101  int32 frameRate, int32 trigger = -1, bool stick_when_done = false);
102 machine *series_ranged_play_xy(const char *seriesName, int loopCount, int flags,
103  int firstFrame, int lastFrame, int x, int y, int s, int layer,
104  int frameRate, int trigger = -1, bool stick_when_done = false);
105 machine *series_plain_play(const char *seriesName, int32 loopCount, uint32 flags,
106  int32 s, int32 layer, int32 frameRate, int32 trigger = -1, bool stickWhenDone = false);
107 machine *series_play_xy(const char *seriesName, int loopCount, int flags,
108  int x, int y, int scale, int layer, int frameRate, int trigger);
109 
110 machine *series_stream(const char *seriesName, int32 frameRate, int32 layer, int32 trigger);
111 bool series_stream_break_on_frame(machine *m, int32 frameNum, int32 trigger);
112 void series_set_frame_rate(machine *m, int32 newFrameRate);
113 
114 } // namespace M4
115 
116 #endif
Definition: ws_machine.h:155
Definition: gr_series.h:49
intptr frac16
Definition: m4_types.h:45
Graphics::Surface * scale(const Graphics::Surface &srcImage, int xSize, int ySize)
Definition: m4_types.h:78
Definition: m4_types.h:54
Definition: database.h:28