ScummVM API documentation
sequence.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 MADS_SEQUENCE_H
23 #define MADS_SEQUENCE_H
24 
25 #include "common/scummsys.h"
26 #include "common/array.h"
27 #include "common/rect.h"
28 #include "mads/action.h"
29 
30 namespace MADS {
31 
32 class SpriteSlot;
33 
34 enum SequenceTrigger {
35  SEQUENCE_TRIGGER_EXPIRE = 0, // Trigger when the sequence finishes
36  SEQUENCE_TRIGGER_LOOP = 1, // Trigger when the sequence loops
37  SEQUENCE_TRIGGER_SPRITE = 2 // Trigger when sequence reaches specific sprite
38 };
39 
40 enum SpriteAnimType { ANIMTYPE_NONE = 0, ANIMTYPE_CYCLED = 1, ANIMTYPE_PING_PONG = 2, ANIMTYPE_STAMP = 9 };
41 
42 #define SEQUENCE_ENTRY_SUBSET_MAX 5
43 
45  int _count;
46  SequenceTrigger _mode[SEQUENCE_ENTRY_SUBSET_MAX];
47  int _frameIndex[SEQUENCE_ENTRY_SUBSET_MAX];
48  int _trigger[SEQUENCE_ENTRY_SUBSET_MAX];
49 };
50 
51 struct SequenceEntry {
52  bool _active;
53  int8 _spritesIndex;
54  bool _flipped;
55 
56  int _frameIndex;
57  int _frameStart;
58  int _numSprites;
59 
60  SpriteAnimType _animType;
61  int _frameInc;
62 
63  int _depth;
64  int _scale;
65  int _dynamicHotspotIndex;
66 
67  bool _nonFixed;
68  uint32 _flags;
69 
70  Common::Point _position;
71  Common::Point _posDiff;
72  Common::Point _posSign;
73  Common::Point _posAccum;
74  int _triggerCountdown;
75  bool _doneFlag;
76  SequenceSubEntries _entries;
77  TriggerMode _triggerMode;
78 
79  ActionDetails _actionNouns;
80  int _numTicks;
81  int _extraTicks;
82  uint32 _timeout;
83 
84  SequenceEntry();
85 };
86 
87 class MADSEngine;
88 
89 class SequenceList {
90 private:
91  MADSEngine *_vm;
93 public:
95 
96  SequenceEntry &operator[](int index) { return _entries[index]; }
97  void clear();
98  bool addSubEntry(int index, SequenceTrigger mode, int frameIndex, int trigger);
99  int add(int spriteListIndex, bool flipped, int frameIndex, int triggerCountdown, int delayTicks,
100  int extraTicks, int numTicks, int msgX, int msgY, bool nonFixed, int scale, int depth,
101  int frameInc, SpriteAnimType animType, int numSprites, int frameStart);
102 
103  int addTimer(int timeout, int endTrigger);
104  void remove(int seqIndex);
105  int findByTrigger(int trigger);
106  void setSpriteSlot(int seqIndex, SpriteSlot &spriteSlot);
107  bool loadSprites(int seqIndex);
108  void tick();
109  void delay(uint32 priorFrameTime, uint32 currentTime);
110  void setAnimRange(int seqIndex, int startVal, int endVal);
111  void scan();
112  void setDepth(int seqIndex, int depth);
113  void setPosition(int seqIndex, const Common::Point &pt);
114  int addSpriteCycle(int srcSpriteIdx, bool flipped, int numTicks,
115  int triggerCountdown = 0, int timeoutTicks = 0, int extraTicks = 0);
116  int addReverseSpriteCycle(int srcSpriteIdx, bool flipped, int numTicks,
117  int triggerCountdown = 0, int timeoutTicks = 0, int extraTicks = 0);
118 
119  int startCycle(int srcSpriteIdx, bool flipped, int cycleIndex);
120  int startPingPongCycle(int srcSpriteIndex, bool flipped, int numTicks,
121  int triggerCountdown = 0, int timeoutTicks = 0, int extraTicks = 0);
122  void updateTimeout(int destSeqIndex, int srcSeqIndex);
123  void setScale(int spriteIdx, int scale);
124  void setMsgLayout(int seqIndex);
125  void setDone(int seqIndex);
126  void setMotion(int seqIndex, int flags, int deltaX, int deltaY);
127 
128  int addStampCycle(int srcSpriteIdx, bool flipped, int sprite);
129  void setSeqPlayer(int idx, bool flag);
130 };
131 
132 } // End of namespace MADS
133 
134 #endif /* MADS_SEQUENCE_H */
Definition: array.h:52
Definition: sequence.h:51
Graphics::Surface * scale(const Graphics::Surface &srcImage, int xSize, int ySize)
Definition: sprites.h:133
Definition: rect.h:45
Definition: action.h:75
Definition: mads.h:87
Definition: sequence.h:89
Definition: action.h:28
Definition: sequence.h:44