Ticket #8031: patch_screeneffects4.diff

File patch_screeneffects4.diff, 12.9 KB (added by SF/roever, 22 years ago)

third, tested version of patch

  • backends/dc/dc.h

    diff -ur vm_orig/backends/dc/dc.h vm/backends/dc/dc.h
    old new  
    1515  // Draw a bitmap to screen.
    1616  // The screen will not be updated to reflect the new bitmap
    1717  void copy_rect(const byte *buf, int pitch, int x, int y, int w, int h);
     18  void move_screen(int dx, int dy, int height);
    1819
    1920  // Update the dirty areas of the screen
    2021  void update_screen();
  • backends/dc/display.cpp

    diff -ur vm_orig/backends/dc/display.cpp vm/backends/dc/display.cpp
    old new  
    132132  } while (--h);
    133133}
    134134
     135void OSystem_Dreamcast::move_screen(int dx, int dy, int height) {
     136
     137        if ((dx == 0) && (dy == 0))
     138                return;
     139
     140        if (dx == 0) {
     141                // vertical movement
     142                if (dy > 0) {
     143                        // move down
     144                        // copy from bottom to top
     145                        for (int y = height - 1; y >= dy; y--)
     146                                copy_rect(screen + SCREEN_W * (y - dy), SCREEN_W, 0, y, SCREEN_W, 1);
     147                } else {
     148                        // move up
     149                        // copy from top to bottom
     150                        for (int y = 0; y < height + dx; y++)
     151                                copy_rect(screen + SCREEN_W * (y - dy), SCREEN_W, 0, y, SCREEN_W, 1);
     152                }
     153        } else if (dy == 0) {
     154                // horizontal movement
     155                if (dx > 0) {
     156                        // move right
     157                        // copy from right to left
     158                        for (int x = SCREEN_W - 1; x >= dx; x--)
     159                                copy_rect(screen + x - dx, SCREEN_W, x, 0, 1, height);
     160                } else {
     161                        // move left
     162                        // copy from left to right
     163                        for (int x = 0; x < SCREEN_W; x++)
     164                                copy_rect(screen + x - dx, SCREEN_W, x, 0, 1, height);
     165                }
     166        } else {
     167                // free movement
     168                // not neccessary for now
     169        }
     170
     171
     172}
     173
     174
    135175bool OSystem_Dreamcast::show_mouse(bool visible)
    136176{       
    137177  bool last = _ms_visible;
  • backends/mac/mac.cpp

    diff -ur vm_orig/backends/mac/mac.cpp vm/backends/mac/mac.cpp
    old new  
    772772        } while(--h);
    773773}
    774774
     775void OSystem_MAC::move_screen(int dx, int dy) {
     776
     777
     778}
     779
     780
    775781void OSystem_MAC::add_dirty_rect(int x, int y, int w, int h) {
    776782        if (force_full)
    777783                return;
  • backends/morphos/morphos.cpp

    diff -ur vm_orig/backends/morphos/morphos.cpp vm/backends/morphos/morphos.cpp
    old new  
    926926        }
    927927}
    928928
     929void OSystem_MorphOS::move_screen(int dx, int dy, int height) {
     930
     931        if ((dx == 0) && (dy == 0))
     932                return;
     933
     934        if (dx == 0) {
     935                // vertical movement
     936                if (dy > 0) {
     937                        // move down
     938                        // copy from bottom to top
     939                        for (int y = height - 1; y >= dy; y--)
     940                                copy_rect((byte *)ScummBuffer + ScummBufferWidth * (y - dy), ScummBufferWidth, 0, y, ScummBufferWidth, 1);
     941                } else {
     942                        // move up
     943                        // copy from top to bottom
     944                        for (int y = 0; y < height + dx; y++)
     945                                copy_rect((byte *)ScummBuffer + ScummBufferWidth * (y - dy), ScummBufferWidth, 0, y, ScummBufferWidth, 1);
     946                }
     947        } else if (dy == 0) {
     948                // horizontal movement
     949                if (dx > 0) {
     950                        // move right
     951                        // copy from right to left
     952                        for (int x = ScummBufferWidth - 1; x >= dx; x--)
     953                                copy_rect((byte *)ScummBuffer + x - dx, ScummBufferWidth, x, 0, 1, height);
     954                } else {
     955                        // move left
     956                        // copy from left to right
     957                        for (int x = 0; x < ScummBufferWidth; x++)
     958                                copy_rect((byte *)ScummBuffer + x - dx, ScummBufferWidth, x, 0, 1, height);
     959                }
     960        } else {
     961                // free movement
     962                // not neccessary for now
     963        }
     964
     965
     966}
     967
     968
    929969bool OSystem_MorphOS::AddUpdateRect(WORD x, WORD y, WORD w, WORD h)
    930970{
    931971        if (x < 0) { w+=x; x = 0; }
  • backends/morphos/morphos.h

    diff -ur vm_orig/backends/morphos/morphos.h vm/backends/morphos/morphos.h
    old new  
    4747                // Draw a bitmap to screen.
    4848                // The screen will not be updated to reflect the new bitmap
    4949                virtual void copy_rect(const byte *buf, int pitch, int x, int y, int w, int h);
     50                void move_screen(int dx, int dy, int height);
    5051
    5152                // Update the dirty areas of the screen
    5253                virtual void update_screen();
  • backends/null/null.cpp

    diff -ur vm_orig/backends/null/null.cpp vm/backends/null/null.cpp
    old new  
    3030        void set_palette(const byte *colors, uint start, uint num) {}
    3131        void init_size(uint w, uint h);
    3232        void copy_rect(const byte *buf, int pitch, int x, int y, int w, int h) {}
     33        void move_screen(int dx, int dy) {}
    3334        void update_screen() {}
    3435        bool show_mouse(bool visible) { return false; }
    3536        void set_mouse_pos(int x, int y) {}
  • backends/sdl/sdl-common.cpp

    diff -ur vm_orig/backends/sdl/sdl-common.cpp vm/backends/sdl/sdl-common.cpp
    old new  
    135135}
    136136
    137137
     138void OSystem_SDL_Common::move_screen(int dx, int dy, int height) {
     139
     140        if ((dx == 0) && (dy == 0))
     141                return;
     142
     143        if (dx == 0) {
     144                // vertical movement
     145                if (dy > 0) {
     146                        // move down
     147                        // copy from bottom to top
     148                        for (int y = height - 1; y >= dy; y--)
     149                                copy_rect((byte *)sdl_screen->pixels + SCREEN_WIDTH * (y - dy), SCREEN_WIDTH, 0, y, SCREEN_WIDTH, 1);
     150                } else {
     151                        // move up
     152                        // copy from top to bottom
     153                        for (int y = 0; y < height + dx; y++)
     154                                copy_rect((byte *)sdl_screen->pixels + SCREEN_WIDTH * (y - dy), SCREEN_WIDTH, 0, y, SCREEN_WIDTH, 1);
     155                }
     156        } else if (dy == 0) {
     157                // horizontal movement
     158                if (dx > 0) {
     159                        // move right
     160                        // copy from right to left
     161                        for (int x = SCREEN_WIDTH - 1; x >= dx; x--)
     162                                copy_rect((byte *)sdl_screen->pixels + x - dx, SCREEN_WIDTH, x, 0, 1, height);
     163                } else {
     164                        // move left
     165                        // copy from left to right
     166                        for (int x = 0; x < SCREEN_WIDTH; x++)
     167                                copy_rect((byte *)sdl_screen->pixels + x - dx, SCREEN_WIDTH, x, 0, 1, height);
     168                }
     169        } else {
     170                // free movement
     171                // not neccessary for now
     172        }
     173}
     174
    138175void OSystem_SDL_Common::add_dirty_rect(int x, int y, int w, int h) {
    139176        if (force_full)
    140177                return;
  • backends/sdl/sdl-common.h

    diff -ur vm_orig/backends/sdl/sdl-common.h vm/backends/sdl/sdl-common.h
    old new  
    4242        // The screen will not be updated to reflect the new bitmap
    4343        void copy_rect(const byte *buf, int pitch, int x, int y, int w, int h);
    4444
     45        void move_screen(int dx, int dy, int height);
     46
    4547        // Update the dirty areas of the screen
    4648        void update_screen() = 0;
    4749
  • backends/wince/pocketpc.cpp

    diff -ur vm_orig/backends/wince/pocketpc.cpp vm/backends/wince/pocketpc.cpp
    old new  
    9595        // The screen will not be updated to reflect the new bitmap
    9696        void copy_rect(const byte *buf, int pitch, int x, int y, int w, int h);
    9797
     98        void move_screen(int dx, int dy, int height);
     99
    98100        // Update the dirty areas of the screen
    99101        void update_screen();
    100102
     
    12151217        } while (--h);
    12161218}
    12171219
     1220void OSystem_WINCE3::move_screen(int dx, int dy, int height) {
     1221
     1222        if ((dx == 0) && (dy == 0))
     1223                return;
     1224
     1225        if (dx == 0) {
     1226                // vertical movement
     1227                if (dy > 0) {
     1228                        // move down
     1229                        // copy from bottom to top
     1230                        for (int y = height - 1; y >= dy; y--)
     1231                                copy_rect(_gfx_buf + SCREEN_WIDTH * (y - dy), SCREEN_WIDTH, 0, y, SCREEN_WIDTH, 1);
     1232                } else {
     1233                        // move up
     1234                        // copy from top to bottom
     1235                        for (int y = 0; y < height + dx; y++)
     1236                                copy_rect(_gfx_buf + SCREEN_WIDTH * (y - dy), SCREEN_WIDTH, 0, y, SCREEN_WIDTH, 1);
     1237                }
     1238        } else if (dy == 0) {
     1239                // horizontal movement
     1240                if (dx > 0) {
     1241                        // move right
     1242                        // copy from right to left
     1243                        for (int x = SCREEN_WIDTH - 1; x >= dx; x--)
     1244                                copy_rect(_gfx_buf + x - dx, SCREEN_WIDTH, x, 0, 1, height);
     1245                } else {
     1246                        // move left
     1247                        // copy from left to right
     1248                        for (int x = 0; x < SCREEN_WIDTH; x++)
     1249                                copy_rect(_gfx_buf + x - dx, SCREEN_WIDTH, x, 0, 1, height);
     1250                }
     1251        } else {
     1252                // free movement
     1253                // not neccessary for now
     1254        }
     1255
     1256
     1257}
     1258
     1259
    12181260void OSystem_WINCE3::update_screen() {
    12191261
    12201262        if (!hide_cursor)
  • backends/x11/x11.cpp

    diff -ur vm_orig/backends/x11/x11.cpp vm/backends/x11/x11.cpp
    old new  
    6262        // The screen will not be updated to reflect the new bitmap
    6363        void copy_rect(const byte *buf, int pitch, int x, int y, int w, int h);
    6464
     65        void move_screen(int dx, int dy, int height);
     66
    6567        // Update the dirty areas of the screen
    6668        void update_screen();
    6769
     
    508510                buf += pitch;
    509511        }
    510512}
     513
     514void OSystem_X11::move_screen(int dx, int dy, int height) {
     515
     516        if ((dx == 0) && (dy == 0))
     517                return;
     518
     519        if (dx == 0) {
     520                // vertical movement
     521                if (dy > 0) {
     522                        // move down
     523                        // copy from bottom to top
     524                        for (int y = height - 1; y >= dy; y--)
     525                                copy_rect(local_fb + fb_width * (y - dy), fb_width, 0, y, fb_width, 1);
     526                } else {
     527                        // move up
     528                        // copy from top to bottom
     529                        for (int y = 0; y < height + dx; y++)
     530                                copy_rect(local_fb + fb_width * (y - dy), fb_width, 0, y, fb_width, 1);
     531                }
     532        } else if (dy == 0) {
     533                // horizontal movement
     534                if (dx > 0) {
     535                        // move right
     536                        // copy from right to left
     537                        for (int x = fb_width - 1; x >= dx; x--)
     538                                copy_rect(local_fb + x - dx, fb_width, x, 0, 1, height);
     539                } else {
     540                        // move left
     541                        // copy from left to right
     542                        for (int x = 0; x < fb_width; x++)
     543                                copy_rect(local_fb + x - dx, fb_width, x, 0, 1, height);
     544                }
     545        } else {
     546                // free movement
     547                // not neccessary for now
     548        }
     549}
     550
    511551
    512552void OSystem_X11::update_screen_helper(const dirty_square * d, dirty_square * dout)
    513553{
  • common/system.h

    diff -ur vm_orig/common/system.h vm/common/system.h
    old new  
    9090        // The screen will not be updated to reflect the new bitmap
    9191        virtual void copy_rect(const byte *buf, int pitch, int x, int y, int w, int h) = 0;
    9292
     93        // Moves the screen content around by the given amount of pixels
     94        // but only the top height pixel rows, the rest stays untouched
     95        virtual void move_screen(int dx, int dy, int height) = 0;
     96
    9397        // Update the dirty areas of the screen
    9498        virtual void update_screen() = 0;
    9599
  • scumm/gfx.cpp

    diff -ur vm_orig/scumm/gfx.cpp vm/scumm/gfx.cpp
    old new  
    677677                dissolveEffect(8, 8);
    678678                break;
    679679        case 130:
    680                 unkScreenEffect1();
     680                scrollEffect(3); // right   unkScreenEffect1();
    681681                break;
    682682        case 131:
    683                 unkScreenEffect2();
     683                scrollEffect(2); // left     unkScreenEffect2();
    684684                break;
    685685        case 132:
    686                 unkScreenEffect3();
     686                scrollEffect(1);  // down    unkScreenEffect3();
    687687                break;
    688688        case 133:
    689                 unkScreenEffect4();
     689                scrollEffect(0);  // up   unkScreenEffect4();
    690690                break;
    691691        case 134:
    692692                dissolveEffect(1, 1);
     
    20872087                waitForTimer(30);
    20882088        }
    20892089}
     2090
     2091void Scumm::scrollEffect(int dir) {
     2092
     2093        VirtScreen *vs = &virtscr[0];
     2094
     2095        int x, y;
     2096        int step;
     2097
     2098        if ((dir == 0) || (dir == 1))
     2099                step = vs->height;
     2100        else
     2101                step = vs->width;
     2102
     2103#define scrolltime 500  // ms the scroll is supposed to take
     2104#define picturedelay 20
     2105
     2106        step /= (scrolltime/picturedelay);
     2107
     2108        switch (dir) {
     2109        case 0:
     2110                //up
     2111                y = 1 + step;
     2112                while (y < vs->height) {
     2113                        _system->move_screen(0, -step, vs->height);
     2114                        _system->copy_rect(vs->screenPtr + vs->xstart + (y - step) * vs->width,
     2115                                vs->width,
     2116                                0, vs->height - step,
     2117                                vs->width, step);
     2118                        _system->update_screen();
     2119                        waitForTimer(picturedelay);
     2120
     2121                        y += step;
     2122                }
     2123                break;
     2124        case 1:
     2125                // down
     2126                y = 1 + step;
     2127                while (y < vs->height) {
     2128                        _system->move_screen(0, step, vs->height);
     2129                        _system->copy_rect(vs->screenPtr + vs->xstart + vs->width * (vs->height-y),
     2130                                vs->width,
     2131                                0, 0,
     2132                                vs->width, step);
     2133                        _system->update_screen();
     2134                        waitForTimer(picturedelay);
     2135
     2136                        y += step;
     2137                }
     2138                break;
     2139        case 2:
     2140                // left
     2141                x = 1 + step;
     2142                while (x < vs->width) {
     2143                        _system->move_screen(-step, 0, vs->height);
     2144                        _system->copy_rect(vs->screenPtr + vs->xstart + x - step,
     2145                                vs->width,
     2146                                vs->width - step, 0,
     2147                                step, vs->height);
     2148                        _system->update_screen();
     2149                        waitForTimer(picturedelay);
     2150
     2151                        x += step;
     2152                }
     2153                break;
     2154        case 3:
     2155                // right
     2156                x = 1 + step;
     2157                while (x < vs->width) {
     2158                        _system->move_screen(step, 0, vs->height);
     2159                        _system->copy_rect(vs->screenPtr + vs->xstart + vs->width - x,
     2160                                vs->width,
     2161                                0, 0,
     2162                                step, vs->height);
     2163                        _system->update_screen();
     2164                        waitForTimer(picturedelay);
     2165
     2166                        x += step;
     2167                }
     2168                break;
     2169        }
     2170}
     2171
    20902172
    20912173void Scumm::unkScreenEffect5(int a) {
    20922174        // unkScreenEffect5(0), which is used by FOA during the opening
  • scumm/scumm.h

    diff -ur vm_orig/scumm/scumm.h vm/scumm/scumm.h
    old new  
    837837        void unkScreenEffect5(int a);
    838838        void transitionEffect(int a);           // former unkScreenEffect7
    839839        void dissolveEffect(int width, int height);     // former unkScreenEffect5(0) and unkScreenEffect6
     840        void scrollEffect(int dir);     // former unkScreenEffects 1-4
    840841
    841842        void decompressBomp(byte *dst, byte *src, int w, int h);
    842843        uint _shakeFrame;