Ticket #8031: patch_screeneffects.diff

File patch_screeneffects.diff, 11.5 KB (added by SF/roever, 18 years ago)

patch against august 30. cvs version

Line 
1diff -ur scummvm/backends/dc/display.cpp scummvm_my/backends/dc/display.cpp
2--- scummvm/backends/dc/display.cpp Wed Aug 21 18:07:09 2002
3+++ scummvm_my/backends/dc/display.cpp Fri Aug 30 21:37:42 2002
4@@ -132,6 +132,46 @@
5 } while (--h);
6 }
7
8+void OSystem_Dreamcast::move_screen(int dx, int dy) {
9+
10+ if ((dx == 0) && (dy == 0))
11+ return;
12+
13+ if (dx == 0) {
14+ // vertical movement
15+ if (dy > 0) {
16+ // move down
17+ // copy from bottom to top
18+ for (int y = 200; y >= dy; y--)
19+ copy_rect(screen + SCREEN_W * (y - dy), SCREEN_W, 0, y, SCREEN_W, 1);
20+ } else {
21+ // move up
22+ // copy from top to bottom
23+ for (int y = 0; y < 200 + dx; y++)
24+ copy_rect(screen + SCREEN_W * (y - dy), SCREEN_W, 0, y, SCREEN_W, 1);
25+ }
26+ } else if (dy == 0) {
27+ // horizontal movement
28+ if (dx > 0) {
29+ // move right
30+ // copy from right to left
31+ for (int x = 320; x >= dx; x--)
32+ copy_rect(screen + x - dx, SCREEN_W, x, 0, 1, SCREEN_H);
33+ } else {
34+ // move left
35+ // copy from left to right
36+ for (int x = 0; x < 320; x++)
37+ copy_rect(screen + x - dx, SCREEN_W, x, 0, 1, SCREEN_H);
38+ }
39+ } else {
40+ // free movement
41+ // not neccessary for now
42+ }
43+}
44+
45+
46 bool OSystem_Dreamcast::show_mouse(bool visible)
47 {
48 bool last = _ms_visible;
49diff -ur scummvm/backends/mac/mac.cpp scummvm_my/backends/mac/mac.cpp
50--- scummvm/backends/mac/mac.cpp Wed Aug 21 18:07:11 2002
51+++ scummvm_my/backends/mac/mac.cpp Fri Aug 30 21:36:13 2002
52@@ -772,6 +772,12 @@
53 } while(--h);
54 }
55
56+void OSystem_MAC::move_screen(int dx, int dy) {
57+
58+
59+}
60+
61+
62 void OSystem_MAC::add_dirty_rect(int x, int y, int w, int h) {
63 if (force_full)
64 return;
65diff -ur scummvm/backends/morphos/morphos.cpp scummvm_my/backends/morphos/morphos.cpp
66--- scummvm/backends/morphos/morphos.cpp Thu Aug 22 14:09:06 2002
67+++ scummvm_my/backends/morphos/morphos.cpp Fri Aug 30 21:39:34 2002
68@@ -926,6 +926,46 @@
69 }
70 }
71
72+void OSystem_MorphOS::move_screen(int dx, int dy) {
73+
74+ if ((dx == 0) && (dy == 0))
75+ return;
76+
77+ if (dx == 0) {
78+ // vertical movement
79+ if (dy > 0) {
80+ // move down
81+ // copy from bottom to top
82+ for (int y = 200; y >= dy; y--)
83+ copy_rect((byte *)ScummBuffer + ScummBufferWidth * (y - dy), ScummBufferWidth, 0, y, ScummBufferWidth, 1);
84+ } else {
85+ // move up
86+ // copy from top to bottom
87+ for (int y = 0; y < 200 + dx; y++)
88+ copy_rect((byte *)ScummBuffer + ScummBufferWidth * (y - dy), ScummBufferWidth, 0, y, ScummBufferWidth, 1);
89+ }
90+ } else if (dy == 0) {
91+ // horizontal movement
92+ if (dx > 0) {
93+ // move right
94+ // copy from right to left
95+ for (int x = 320; x >= dx; x--)
96+ copy_rect((byte *)ScummBuffer + x - dx, ScummBufferWidth, x, 0, 1, ScummBufferHeight);
97+ } else {
98+ // move left
99+ // copy from left to right
100+ for (int x = 0; x < 320; x++)
101+ copy_rect((byte *)ScummBuffer + x - dx, ScummBufferWidth, x, 0, 1, ScummBufferHeight);
102+ }
103+ } else {
104+ // free movement
105+ // not neccessary for now
106+ }
107+
108+
109+}
110+
111+
112 bool OSystem_MorphOS::AddUpdateRect(WORD x, WORD y, WORD w, WORD h)
113 {
114 if (x < 0) { w+=x; x = 0; }
115diff -ur scummvm/backends/null/null.cpp scummvm_my/backends/null/null.cpp
116--- scummvm/backends/null/null.cpp Sat Aug 24 12:28:32 2002
117+++ scummvm_my/backends/null/null.cpp Fri Aug 30 21:40:06 2002
118@@ -30,6 +30,7 @@
119 void set_palette(const byte *colors, uint start, uint num) {}
120 void init_size(uint w, uint h);
121 void copy_rect(const byte *buf, int pitch, int x, int y, int w, int h) {}
122+ void move_screen(int dx, int dy) {}
123 void update_screen() {}
124 bool show_mouse(bool visible) { return false; }
125 void set_mouse_pos(int x, int y) {}
126diff -ur scummvm/backends/sdl/sdl-common.cpp scummvm_my/backends/sdl/sdl-common.cpp
127--- scummvm/backends/sdl/sdl-common.cpp Sat Aug 24 12:41:32 2002
128+++ scummvm_my/backends/sdl/sdl-common.cpp Fri Aug 30 20:38:38 2002
129@@ -135,6 +135,43 @@
130 }
131
132
133+void OSystem_SDL_Common::move_screen(int dx, int dy) {
134+
135+ if ((dx == 0) && (dy == 0))
136+ return;
137+
138+ if (dx == 0) {
139+ // vertical movement
140+ if (dy > 0) {
141+ // move down
142+ // copy from bottom to top
143+ for (int y = 200; y >= dy; y--)
144+ copy_rect((byte *)sdl_screen->pixels + SCREEN_WIDTH * (y - dy), SCREEN_WIDTH, 0, y, SCREEN_WIDTH, 1);
145+ } else {
146+ // move up
147+ // copy from top to bottom
148+ for (int y = 0; y < 200 + dx; y++)
149+ copy_rect((byte *)sdl_screen->pixels + SCREEN_WIDTH * (y - dy), SCREEN_WIDTH, 0, y, SCREEN_WIDTH, 1);
150+ }
151+ } else if (dy == 0) {
152+ // horizontal movement
153+ if (dx > 0) {
154+ // move right
155+ // copy from right to left
156+ for (int x = 320; x >= dx; x--)
157+ copy_rect((byte *)sdl_screen->pixels + x - dx, SCREEN_WIDTH, x, 0, 1, SCREEN_HEIGHT);
158+ } else {
159+ // move left
160+ // copy from left to right
161+ for (int x = 0; x < 320; x++)
162+ copy_rect((byte *)sdl_screen->pixels + x - dx, SCREEN_WIDTH, x, 0, 1, SCREEN_HEIGHT);
163+ }
164+ } else {
165+ // free movement
166+ // not neccessary for now
167+ }
168+}
169+
170 void OSystem_SDL_Common::add_dirty_rect(int x, int y, int w, int h) {
171 if (force_full)
172 return;
173diff -ur scummvm/backends/sdl/sdl-common.h scummvm_my/backends/sdl/sdl-common.h
174--- scummvm/backends/sdl/sdl-common.h Sat Aug 24 12:41:32 2002
175+++ scummvm_my/backends/sdl/sdl-common.h Fri Aug 30 18:10:21 2002
176@@ -42,6 +42,8 @@
177 // The screen will not be updated to reflect the new bitmap
178 void copy_rect(const byte *buf, int pitch, int x, int y, int w, int h);
179
180+ void move_screen(int dx, int dy);
181+
182 // Update the dirty areas of the screen
183 void update_screen() = 0;
184
185diff -ur scummvm/backends/wince/pocketpc.cpp scummvm_my/backends/wince/pocketpc.cpp
186--- scummvm/backends/wince/pocketpc.cpp Wed Aug 21 18:07:20 2002
187+++ scummvm_my/backends/wince/pocketpc.cpp Fri Aug 30 21:40:31 2002
188@@ -1215,6 +1215,46 @@
189 } while (--h);
190 }
191
192+void OSystem_WINCE3::move_screen(int dx, int dy) {
193+
194+ if ((dx == 0) && (dy == 0))
195+ return;
196+
197+ if (dx == 0) {
198+ // vertical movement
199+ if (dy > 0) {
200+ // move down
201+ // copy from bottom to top
202+ for (int y = 200; y >= dy; y--)
203+ copy_rect(_gfx_buf + SCREEN_WIDTH * (y - dy), SCREEN_WIDTH, 0, y, SCREEN_WIDTH, 1);
204+ } else {
205+ // move up
206+ // copy from top to bottom
207+ for (int y = 0; y < 200 + dx; y++)
208+ copy_rect(_gfx_buf + SCREEN_WIDTH * (y - dy), SCREEN_WIDTH, 0, y, SCREEN_WIDTH, 1);
209+ }
210+ } else if (dy == 0) {
211+ // horizontal movement
212+ if (dx > 0) {
213+ // move right
214+ // copy from right to left
215+ for (int x = 320; x >= dx; x--)
216+ copy_rect(_gfx_buf + x - dx, SCREEN_WIDTH, x, 0, 1, SCREEN_HEIGHT);
217+ } else {
218+ // move left
219+ // copy from left to right
220+ for (int x = 0; x < 320; x++)
221+ copy_rect(_gfx_buf + x - dx, SCREEN_WIDTH, x, 0, 1, SCREEN_HEIGHT);
222+ }
223+ } else {
224+ // free movement
225+ // not neccessary for now
226+ }
227+}
228+
229+
230 void OSystem_WINCE3::update_screen() {
231
232 if (!hide_cursor)
233diff -ur scummvm/backends/x11/x11.cpp scummvm_my/backends/x11/x11.cpp
234--- scummvm/backends/x11/x11.cpp Thu Aug 29 21:40:51 2002
235+++ scummvm_my/backends/x11/x11.cpp Fri Aug 30 21:29:18 2002
236@@ -60,7 +60,9 @@
237
238 // Draw a bitmap to screen.
239 // The screen will not be updated to reflect the new bitmap
240- void copy_rect(const byte *buf, int pitch, int x, int y, int w, int h);
241+ void copy_rect(const byte *buf, int pitch, int x, int y, int w, int h);
242+
243+ void move_screen(int dx, int dy);
244
245 // Update the dirty areas of the screen
246 void update_screen();
247@@ -508,6 +510,46 @@
248 buf += pitch;
249 }
250 }
251+
252+void OSystem_X11::move_screen(int dx, int dy) {
253+
254+ if ((dx == 0) && (dy == 0))
255+ return;
256+
257+ if (dx == 0) {
258+ // vertical movement
259+ if (dy > 0) {
260+ // move down
261+ // copy from bottom to top
262+ for (int y = 200; y >= dy; y--)
263+ copy_rect(local_fb + fb_width * (y - dy), fb_width, 0, y, fb_width, 1);
264+ } else {
265+ // move up
266+ // copy from top to bottom
267+ for (int y = 0; y < 200 + dx; y++)
268+ copy_rect(local_fb + fb_width * (y - dy), fb_width, 0, y, fb_width, 1);
269+ }
270+ } else if (dy == 0) {
271+ // horizontal movement
272+ if (dx > 0) {
273+ // move right
274+ // copy from right to left
275+ for (int x = 320; x >= dx; x--)
276+ copy_rect(local_fb + x - dx, fb_width, x, 0, 1, fb_height);
277+ } else {
278+ // move left
279+ // copy from left to right
280+ for (int x = 0; x < 320; x++)
281+ copy_rect(local_fb + x - dx, fb_width, x, 0, 1, fb_height);
282+ }
283+ } else {
284+ // free movement
285+ // not neccessary for now
286+ }
287+
288+
289+}
290+
291
292 void OSystem_X11::update_screen_helper(const dirty_square * d, dirty_square * dout)
293 {
294diff -ur scummvm/common/system.h scummvm_my/common/system.h
295--- scummvm/common/system.h Wed Aug 21 18:07:23 2002
296+++ scummvm_my/common/system.h Fri Aug 30 18:17:33 2002
297@@ -90,6 +90,9 @@
298 // The screen will not be updated to reflect the new bitmap
299 virtual void copy_rect(const byte *buf, int pitch, int x, int y, int w, int h) = 0;
300
301+ // Moves the screen content around by the given amount of pixels
302+ virtual void move_screen(int dx, int dy) = 0;
303+
304 // Update the dirty areas of the screen
305 virtual void update_screen() = 0;
306
307diff -ur scummvm/scumm/gfx.cpp scummvm_my/scumm/gfx.cpp
308--- scummvm/scumm/gfx.cpp Thu Aug 29 22:01:25 2002
309+++ scummvm_my/scumm/gfx.cpp Fri Aug 30 21:35:11 2002
310@@ -677,16 +677,16 @@
311 dissolveEffect(8, 8);
312 break;
313 case 130:
314- unkScreenEffect1();
315+ scrollEffect(3); // right unkScreenEffect1();
316 break;
317 case 131:
318- unkScreenEffect2();
319+ scrollEffect(2); // left unkScreenEffect2();
320 break;
321 case 132:
322- unkScreenEffect3();
323+ scrollEffect(1); // up unkScreenEffect3();
324 break;
325 case 133:
326- unkScreenEffect4();
327+ scrollEffect(0); // down unkScreenEffect4();
328 break;
329 case 134:
330 dissolveEffect(1, 1);
331@@ -2087,6 +2087,76 @@
332 waitForTimer(30);
333 }
334 }
335+
336+void Scumm::scrollEffect(int dir) {
337+
338+ VirtScreen *vs = &virtscr[0];
339+
340+ int x, y;
341+ int step;
342+
343+ if ((dir == 0) || (dir == 1))
344+ step = vs->height;
345+ else
346+ step = vs->width;
347+
348+#define scrolltime 500 // ms the scroll is supposed to take
349+#define picturedelay 20
350+
351+ step /= (scrolltime/picturedelay);
352+
353+ switch (dir) {
354+ case 0:
355+ //up
356+ y = 1 + step;
357+ while (y < vs->height) {
358+ _system->move_screen(0, -step);
359+ _system->copy_rect(vs->screenPtr + vs->xstart, vs->width, 0, vs->height-y, vs->width, y);
360+ _system->update_screen();
361+ waitForTimer(picturedelay);
362+
363+ y += step;
364+ }
365+ break;
366+ case 1:
367+ // down
368+ y = 1 + step;
369+ while (y < vs->height) {
370+ _system->move_screen(0, step);
371+ _system->copy_rect(vs->screenPtr + vs->xstart + vs->width * (vs->height-y), vs->width, 0, 0, vs->width, y);
372+ _system->update_screen();
373+ waitForTimer(picturedelay);
374+
375+ y += step;
376+ }
377+ break;
378+ case 2:
379+ // left
380+ x = 1 + step;
381+ while (x < vs->width) {
382+ _system->move_screen(-step, 0);
383+ _system->copy_rect(vs->screenPtr + vs->xstart, vs->width, vs->width-x, 0, x, vs->height);
384+ _system->update_screen();
385+ waitForTimer(picturedelay);
386+
387+ x += step;
388+ }
389+ break;
390+ case 3:
391+ // right
392+ x = 1 + step;
393+ while (x < vs->width) {
394+ _system->move_screen(step, 0);
395+ _system->copy_rect(vs->screenPtr + vs->xstart + vs->width - x, vs->width, 0, 0, x, vs->height);
396+ _system->update_screen();
397+ waitForTimer(picturedelay);
398+
399+ x += step;
400+ }
401+ break;
402+ }
403+}
404+
405
406 void Scumm::unkScreenEffect5(int a) {
407 // unkScreenEffect5(0), which is used by FOA during the opening
408diff -ur scummvm/scumm/scumm.h scummvm_my/scumm/scumm.h
409--- scummvm/scumm/scumm.h Fri Aug 30 01:45:15 2002
410+++ scummvm_my/scumm/scumm.h Fri Aug 30 18:30:49 2002
411@@ -837,6 +837,7 @@
412 void unkScreenEffect5(int a);
413 void transitionEffect(int a); // former unkScreenEffect7
414 void dissolveEffect(int width, int height); // former unkScreenEffect5(0) and unkScreenEffect6
415+ void scrollEffect(int dir); // former unkScreenEffects 1-4
416
417 void decompressBomp(byte *dst, byte *src, int w, int h);
418 uint _shakeFrame;
419