ScummVM API documentation
animate.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 SCI_GRAPHICS_ANIMATE_H
23#define SCI_GRAPHICS_ANIMATE_H
24
25#include "sci/graphics/helpers.h"
26
27namespace Sci {
28
29// Flags for the signal selector
30enum ViewSignals {
31 kSignalStopUpdate = 0x0001,
32 kSignalViewUpdated = 0x0002,
33 kSignalNoUpdate = 0x0004,
34 kSignalHidden = 0x0008,
35 kSignalFixedPriority = 0x0010,
36 kSignalAlwaysUpdate = 0x0020,
37 kSignalForceUpdate = 0x0040,
38 kSignalRemoveView = 0x0080,
39 kSignalFrozen = 0x0100, // I got frozen today!!
40 //kSignalExtraActor = 0x0200, // unused by us, defines all actors that may be included into the background if speed is too slow
41 kSignalHitObstacle = 0x0400, // used in the actor movement code by kDoBresen()
42 kSignalDoesntTurn = 0x0800, // used by _k_dirloop() to determine if an actor can turn or not
43 //kSignalNoCycler = 0x1000, // unused by us
44 //kSignalIgnoreHorizon = 0x2000, // unused by us, defines actor that can ignore horizon
45 kSignalIgnoreActor = 0x4000,
46 kSignalDisposeMe = 0x8000
47};
48
49enum ViewScaleSignals {
50 kScaleSignalDoScaling = 0x0001, // enables scaling when drawing that cel (involves scaleX and scaleY)
51 kScaleSignalGlobalScaling = 0x0002, // means that global scaling shall get applied on that cel (sets scaleX/scaleY)
52 kScaleSignalHoyle4SpecialHandling = 0x0004 // HOYLE4-exclusive: special handling inside kAnimate, is used when giving out cards
53};
54
56 int16 givenOrderNo;
57 reg_t object;
58 GuiResourceId viewId;
59 int16 loopNo;
60 int16 celNo;
61 int16 paletteNo;
62 int16 x, y, z;
63 int16 priority;
64 uint16 signal;
65 uint16 scaleSignal;
66 int16 scaleX;
67 int16 scaleY;
68 Common::Rect celRect;
69 bool showBitsFlag;
70 reg_t castHandle;
71};
74
75class Console;
76class GfxCache;
77class GfxCursor;
78class GfxPorts;
79class GfxPaint16;
80class GfxScreen;
81class GfxPalette;
82class GfxTransitions;
83class GfxView;
88public:
89 GfxAnimate(EngineState *state, ScriptPatcher *scriptPatcher, GfxCache *cache, GfxCompare *compare, GfxPorts *ports, GfxPaint16 *paint16, GfxScreen *screen, GfxPalette *palette, GfxCursor *cursor, GfxTransitions *transitions);
90 virtual ~GfxAnimate();
91
92 bool isFastCastEnabled() {
93 return _fastCastEnabled;
94 }
95
96 void disposeLastCast();
97 bool invoke(List *list, int argc, reg_t *argv);
98 void makeSortedList(List *list);
99 void applyGlobalScaling(AnimateList::iterator entry, GfxView *view);
100 void fill(byte &oldPicNotValid);
101 void update();
102 void drawCels();
103 void updateScreen(byte oldPicNotValid);
104 void restoreAndDelete(int argc, reg_t *argv);
105 void reAnimate(Common::Rect rect);
106 void addToPicDrawCels();
107 void addToPicDrawView(GuiResourceId viewId, int16 loopNo, int16 celNo, int16 leftPos, int16 topPos, int16 priority, int16 control);
108 void printAnimateList(Console *con);
109
110 virtual void kernelAnimate(reg_t listReference, bool cycle, int argc, reg_t *argv);
111 virtual void kernelAddToPicList(reg_t listReference, int argc, reg_t *argv);
112 virtual void kernelAddToPicView(GuiResourceId viewId, int16 loopNo, int16 celNo, int16 leftPos, int16 topPos, int16 priority, int16 control);
113
114private:
115 void init();
116 bool detectFastCast();
117
118 void addToPicSetPicNotValid();
119 void animateShowPic();
120 void adjustInvalidCels(GfxView *view, AnimateList::iterator it);
121 void processViewScaling(GfxView *view, AnimateList::iterator it);
122 void setNsRect(GfxView *view, AnimateList::iterator it);
123
124 EngineState *_s;
125 ScriptPatcher *_scriptPatcher;
126 GfxCache *_cache;
127 GfxCompare *_compare;
128 GfxPorts *_ports;
129 GfxPaint16 *_paint16;
130 GfxScreen *_screen;
131 GfxPalette *_palette;
132 GfxCursor *_cursor;
133 GfxTransitions *_transitions;
134
135 AnimateList _list;
136 AnimateArray _lastCastData;
137
138 bool _fastCastEnabled;
139};
140
141} // End of namespace Sci
142
143#endif // SCI_GRAPHICS_ANIMATE_H
Definition: console.h:36
Definition: animate.h:87
Definition: cache.h:38
Definition: compare.h:34
Definition: cursor.h:55
Definition: paint16.h:37
Definition: palette16.h:41
Definition: ports.h:52
Definition: screen.h:70
Definition: transitions.h:62
Definition: view.h:59
Definition: script_patches.h:91
Definition: console.h:28
Definition: list_intern.h:54
Definition: rect.h:536
Definition: animate.h:55
Definition: state.h:100
Definition: segment.h:202
Definition: vm_types.h:39