1 | Index: engines/scumm/scumm.cpp
|
---|
2 | ===================================================================
|
---|
3 | --- engines/scumm/scumm.cpp (revision 23186)
|
---|
4 | +++ engines/scumm/scumm.cpp (working copy)
|
---|
5 | @@ -370,7 +370,6 @@
|
---|
6 | _newEffect = 0;
|
---|
7 | _switchRoomEffect2 = 0;
|
---|
8 | _switchRoomEffect = 0;
|
---|
9 | - _scrollBuffer = NULL;
|
---|
10 |
|
---|
11 | _doEffect = false;
|
---|
12 | _currentLights = 0;
|
---|
13 | Index: engines/scumm/gfx.cpp
|
---|
14 | ===================================================================
|
---|
15 | --- engines/scumm/gfx.cpp (revision 23186)
|
---|
16 | +++ engines/scumm/gfx.cpp (working copy)
|
---|
17 | @@ -3052,18 +3052,6 @@
|
---|
18 | _screenEffectFlag = false;
|
---|
19 | }
|
---|
20 |
|
---|
21 | -void ScummEngine::setScrollBuffer() {
|
---|
22 | - if (_switchRoomEffect >= 130 && _switchRoomEffect <= 133) {
|
---|
23 | - // We're going to use scrollEffect(), so we'll need a copy of
|
---|
24 | - // the current VirtScreen zero.
|
---|
25 | - VirtScreen *vs = &virtscr[0];
|
---|
26 | -
|
---|
27 | - free(_scrollBuffer);
|
---|
28 | - _scrollBuffer = (byte *) malloc(vs->h * vs->pitch);
|
---|
29 | - memcpy(_scrollBuffer, vs->getPixels(0, 0), vs->h * vs->pitch);
|
---|
30 | - }
|
---|
31 | -}
|
---|
32 | -
|
---|
33 | /**
|
---|
34 | * Perform a transition effect. There are four different effects possible:
|
---|
35 | * 0: Iris effect
|
---|
36 | @@ -3244,13 +3232,68 @@
|
---|
37 | }
|
---|
38 | }
|
---|
39 |
|
---|
40 | +void ScummEngine::moveScreen(int dx, int dy, int height) {
|
---|
41 | + // Short circuit check - do we have to do anything anyway?
|
---|
42 | + if ((dx == 0 && dy == 0) || height <= 0)
|
---|
43 | + return;
|
---|
44 | +
|
---|
45 | + byte *src, *dst;
|
---|
46 | + int x, y;
|
---|
47 | +
|
---|
48 | + Graphics::Surface screen;
|
---|
49 | + assert(_system->grabRawScreen(&screen));
|
---|
50 | +
|
---|
51 | + // vertical movement
|
---|
52 | + if (dy > 0) {
|
---|
53 | + // move down - copy from bottom to top
|
---|
54 | + dst = (byte *)screen.pixels + (height - 1) * _screenWidth;
|
---|
55 | + src = dst - dy * _screenWidth;
|
---|
56 | + for (y = dy; y < height; y++) {
|
---|
57 | + memcpy(dst, src, _screenWidth);
|
---|
58 | + src -= _screenWidth;
|
---|
59 | + dst -= _screenWidth;
|
---|
60 | + }
|
---|
61 | + } else if (dy < 0) {
|
---|
62 | + // move up - copy from top to bottom
|
---|
63 | + dst = (byte *)screen.pixels;
|
---|
64 | + src = dst - dy * _screenWidth;
|
---|
65 | + for (y = -dy; y < height; y++) {
|
---|
66 | + memcpy(dst, src, _screenWidth);
|
---|
67 | + src += _screenWidth;
|
---|
68 | + dst += _screenWidth;
|
---|
69 | + }
|
---|
70 | + }
|
---|
71 | +
|
---|
72 | + // horizontal movement
|
---|
73 | + if (dx > 0) {
|
---|
74 | + // move right - copy from right to left
|
---|
75 | + dst = (byte *)screen.pixels + (_screenWidth - 1);
|
---|
76 | + src = dst - dx;
|
---|
77 | + for (y = 0; y < height; y++) {
|
---|
78 | + for (x = dx; x < _screenWidth; x++) {
|
---|
79 | + *dst-- = *src--;
|
---|
80 | + }
|
---|
81 | + src += _screenWidth + (_screenWidth - dx);
|
---|
82 | + dst += _screenWidth + (_screenWidth - dx);
|
---|
83 | + }
|
---|
84 | + } else if (dx < 0) {
|
---|
85 | + // move left - copy from left to right
|
---|
86 | + dst = (byte *)screen.pixels;
|
---|
87 | + src = dst - dx;
|
---|
88 | + for (y = 0; y < height; y++) {
|
---|
89 | + for (x = -dx; x < _screenWidth; x++) {
|
---|
90 | + *dst++ = *src++;
|
---|
91 | + }
|
---|
92 | + src += _screenWidth - (_screenWidth + dx);
|
---|
93 | + dst += _screenWidth - (_screenWidth + dx);
|
---|
94 | + }
|
---|
95 | + }
|
---|
96 | +
|
---|
97 | + _system->copyRectToScreen((byte *)screen.pixels, screen.pitch, 0, 0, screen.w, screen.h);
|
---|
98 | + screen.free();
|
---|
99 | +}
|
---|
100 | +
|
---|
101 | void ScummEngine::scrollEffect(int dir) {
|
---|
102 | - // It is at least technically possible that this function will be
|
---|
103 | - // called without _scrollBuffer having been set up, but will it ever
|
---|
104 | - // happen? I don't know.
|
---|
105 | - if (!_scrollBuffer)
|
---|
106 | - warning("scrollEffect: No scroll buffer. This may look bad");
|
---|
107 | -
|
---|
108 | VirtScreen *vs = &virtscr[0];
|
---|
109 |
|
---|
110 | int x, y;
|
---|
111 | @@ -3266,17 +3309,14 @@
|
---|
112 | switch (dir) {
|
---|
113 | case 0:
|
---|
114 | //up
|
---|
115 | - y = step;
|
---|
116 | + y = 1 + step;
|
---|
117 | while (y < vs->h) {
|
---|
118 | - _system->copyRectToScreen(vs->getPixels(0, 0),
|
---|
119 | + moveScreen(0, -step, vs->h);
|
---|
120 | + _system->copyRectToScreen(vs->getPixels(0, y - step),
|
---|
121 | vs->pitch,
|
---|
122 | - 0, vs->h - y,
|
---|
123 | - vs->w, y);
|
---|
124 | - if (_scrollBuffer)
|
---|
125 | - _system->copyRectToScreen(_scrollBuffer + y * vs->w,
|
---|
126 | - vs->pitch,
|
---|
127 | - 0, 0,
|
---|
128 | - vs->w, vs->h - y);
|
---|
129 | + 0, vs->h - step,
|
---|
130 | + vs->w, step);
|
---|
131 | + _system->updateScreen();
|
---|
132 | waitForTimer(kPictureDelay);
|
---|
133 |
|
---|
134 | y += step;
|
---|
135 | @@ -3284,17 +3324,14 @@
|
---|
136 | break;
|
---|
137 | case 1:
|
---|
138 | // down
|
---|
139 | - y = step;
|
---|
140 | + y = 1 + step;
|
---|
141 | while (y < vs->h) {
|
---|
142 | + moveScreen(0, step, vs->h);
|
---|
143 | _system->copyRectToScreen(vs->getPixels(0, vs->h - y),
|
---|
144 | vs->pitch,
|
---|
145 | 0, 0,
|
---|
146 | - vs->w, y);
|
---|
147 | - if (_scrollBuffer)
|
---|
148 | - _system->copyRectToScreen(_scrollBuffer,
|
---|
149 | - vs->pitch,
|
---|
150 | - 0, y,
|
---|
151 | - vs->w, vs->h - y);
|
---|
152 | + vs->w, step);
|
---|
153 | + _system->updateScreen();
|
---|
154 | waitForTimer(kPictureDelay);
|
---|
155 |
|
---|
156 | y += step;
|
---|
157 | @@ -3302,17 +3339,14 @@
|
---|
158 | break;
|
---|
159 | case 2:
|
---|
160 | // left
|
---|
161 | - x = step;
|
---|
162 | + x = 1 + step;
|
---|
163 | while (x < vs->w) {
|
---|
164 | - _system->copyRectToScreen(vs->getPixels(0, 0),
|
---|
165 | + moveScreen(-step, 0, vs->h);
|
---|
166 | + _system->copyRectToScreen(vs->getPixels(x - step, 0),
|
---|
167 | vs->pitch,
|
---|
168 | - vs->w - x, 0,
|
---|
169 | - x, vs->h);
|
---|
170 | - if (_scrollBuffer)
|
---|
171 | - _system->copyRectToScreen(_scrollBuffer + x,
|
---|
172 | - vs->pitch,
|
---|
173 | - 0, 0,
|
---|
174 | - vs->w - x, vs->h);
|
---|
175 | + vs->w - step, 0,
|
---|
176 | + step, vs->h);
|
---|
177 | + _system->updateScreen();
|
---|
178 | waitForTimer(kPictureDelay);
|
---|
179 |
|
---|
180 | x += step;
|
---|
181 | @@ -3320,26 +3354,20 @@
|
---|
182 | break;
|
---|
183 | case 3:
|
---|
184 | // right
|
---|
185 | - x = step;
|
---|
186 | + x = 1 + step;
|
---|
187 | while (x < vs->w) {
|
---|
188 | + moveScreen(step, 0, vs->h);
|
---|
189 | _system->copyRectToScreen(vs->getPixels(vs->w - x, 0),
|
---|
190 | vs->pitch,
|
---|
191 | 0, 0,
|
---|
192 | - x, vs->h);
|
---|
193 | - if (_scrollBuffer)
|
---|
194 | - _system->copyRectToScreen(_scrollBuffer,
|
---|
195 | - vs->pitch,
|
---|
196 | - x, 0,
|
---|
197 | - vs->w - x, vs->h);
|
---|
198 | + step, vs->h);
|
---|
199 | + _system->updateScreen();
|
---|
200 | waitForTimer(kPictureDelay);
|
---|
201 |
|
---|
202 | x += step;
|
---|
203 | }
|
---|
204 | break;
|
---|
205 | }
|
---|
206 | -
|
---|
207 | - free(_scrollBuffer);
|
---|
208 | - _scrollBuffer = NULL;
|
---|
209 | }
|
---|
210 |
|
---|
211 | void ScummEngine::unkScreenEffect6() {
|
---|
212 | Index: engines/scumm/scumm.h
|
---|
213 | ===================================================================
|
---|
214 | --- engines/scumm/scumm.h (revision 23186)
|
---|
215 | +++ engines/scumm/scumm.h (working copy)
|
---|
216 | @@ -988,8 +988,6 @@
|
---|
217 | byte _newEffect, _switchRoomEffect2, _switchRoomEffect;
|
---|
218 | bool _doEffect;
|
---|
219 |
|
---|
220 | - byte *_scrollBuffer;
|
---|
221 | -
|
---|
222 | public:
|
---|
223 | bool isLightOn() const;
|
---|
224 |
|
---|
225 | @@ -1084,6 +1082,7 @@
|
---|
226 | void transitionEffect(int a);
|
---|
227 | void dissolveEffect(int width, int height);
|
---|
228 | void scrollEffect(int dir);
|
---|
229 | + void moveScreen(int dx, int dy, int height);
|
---|
230 |
|
---|
231 | // bomp
|
---|
232 | public:
|
---|
233 | Index: engines/scumm/he/script_v60he.cpp
|
---|
234 | ===================================================================
|
---|
235 | --- engines/scumm/he/script_v60he.cpp (revision 23186)
|
---|
236 | +++ engines/scumm/he/script_v60he.cpp (working copy)
|
---|
237 | @@ -519,7 +519,6 @@
|
---|
238 | } else if (a) {
|
---|
239 | _switchRoomEffect = (byte)(a & 0xFF);
|
---|
240 | _switchRoomEffect2 = (byte)(a >> 8);
|
---|
241 | - setScrollBuffer();
|
---|
242 | } else {
|
---|
243 | fadeIn(_newEffect);
|
---|
244 | }
|
---|
245 | Index: engines/scumm/script_v5.cpp
|
---|
246 | ===================================================================
|
---|
247 | --- engines/scumm/script_v5.cpp (revision 23186)
|
---|
248 | +++ engines/scumm/script_v5.cpp (working copy)
|
---|
249 | @@ -1926,7 +1926,6 @@
|
---|
250 | }
|
---|
251 | _switchRoomEffect = (byte)(a & 0xFF);
|
---|
252 | _switchRoomEffect2 = (byte)(a >> 8);
|
---|
253 | - setScrollBuffer();
|
---|
254 | } else {
|
---|
255 | fadeIn(_newEffect);
|
---|
256 | }
|
---|
257 | Index: engines/scumm/script_v6.cpp
|
---|
258 | ===================================================================
|
---|
259 | --- engines/scumm/script_v6.cpp (revision 23186)
|
---|
260 | +++ engines/scumm/script_v6.cpp (working copy)
|
---|
261 | @@ -1707,7 +1707,6 @@
|
---|
262 | if (a) {
|
---|
263 | _switchRoomEffect = (byte)(a & 0xFF);
|
---|
264 | _switchRoomEffect2 = (byte)(a >> 8);
|
---|
265 | - setScrollBuffer();
|
---|
266 | } else {
|
---|
267 | fadeIn(_newEffect);
|
---|
268 | }
|
---|