Applied roever's screen effects patch (#602595) and fixed LethalWP's Makefile ;)

svn-id: r4909
This commit is contained in:
Michael Pearce 2002-09-09 05:56:11 +00:00
parent 5b8eb34406
commit 0fbefc72aa
12 changed files with 300 additions and 4 deletions

View file

@ -15,6 +15,7 @@ class OSystem_Dreamcast : public OSystem {
// Draw a bitmap to screen.
// The screen will not be updated to reflect the new bitmap
void copy_rect(const byte *buf, int pitch, int x, int y, int w, int h);
void move_screen(int dx, int dy, int height);
// Update the dirty areas of the screen
void update_screen();

View file

@ -132,6 +132,46 @@ void OSystem_Dreamcast::copy_rect(const byte *buf, int pitch, int x, int y,
} while (--h);
}
void OSystem_Dreamcast::move_screen(int dx, int dy, int height) {
if ((dx == 0) && (dy == 0))
return;
if (dx == 0) {
// vertical movement
if (dy > 0) {
// move down
// copy from bottom to top
for (int y = height - 1; y >= dy; y--)
copy_rect(screen + SCREEN_W * (y - dy), SCREEN_W, 0, y, SCREEN_W, 1);
} else {
// move up
// copy from top to bottom
for (int y = 0; y < height + dx; y++)
copy_rect(screen + SCREEN_W * (y - dy), SCREEN_W, 0, y, SCREEN_W, 1);
}
} else if (dy == 0) {
// horizontal movement
if (dx > 0) {
// move right
// copy from right to left
for (int x = SCREEN_W - 1; x >= dx; x--)
copy_rect(screen + x - dx, SCREEN_W, x, 0, 1, height);
} else {
// move left
// copy from left to right
for (int x = 0; x < SCREEN_W; x++)
copy_rect(screen + x - dx, SCREEN_W, x, 0, 1, height);
}
} else {
// free movement
// not neccessary for now
}
}
bool OSystem_Dreamcast::show_mouse(bool visible)
{
bool last = _ms_visible;

View file

@ -772,6 +772,12 @@ void OSystem_MAC::copy_rect(const byte *buf, int pitch, int x, int y, int w, int
} while(--h);
}
void OSystem_MAC::move_screen(int dx, int dy) {
}
void OSystem_MAC::add_dirty_rect(int x, int y, int w, int h) {
if (force_full)
return;

View file

@ -927,6 +927,46 @@ void OSystem_MorphOS::copy_rect(const byte *src, int pitch, int x, int y, int w,
}
}
void OSystem_MorphOS::move_screen(int dx, int dy, int height) {
if ((dx == 0) && (dy == 0))
return;
if (dx == 0) {
// vertical movement
if (dy > 0) {
// move down
// copy from bottom to top
for (int y = height - 1; y >= dy; y--)
copy_rect((byte *)ScummBuffer + ScummBufferWidth * (y - dy), ScummBufferWidth, 0, y, ScummBufferWidth, 1);
} else {
// move up
// copy from top to bottom
for (int y = 0; y < height + dx; y++)
copy_rect((byte *)ScummBuffer + ScummBufferWidth * (y - dy), ScummBufferWidth, 0, y, ScummBufferWidth, 1);
}
} else if (dy == 0) {
// horizontal movement
if (dx > 0) {
// move right
// copy from right to left
for (int x = ScummBufferWidth - 1; x >= dx; x--)
copy_rect((byte *)ScummBuffer + x - dx, ScummBufferWidth, x, 0, 1, height);
} else {
// move left
// copy from left to right
for (int x = 0; x < ScummBufferWidth; x++)
copy_rect((byte *)ScummBuffer + x - dx, ScummBufferWidth, x, 0, 1, height);
}
} else {
// free movement
// not neccessary for now
}
}
bool OSystem_MorphOS::AddUpdateRect(WORD x, WORD y, WORD w, WORD h)
{
if (UpdateRects > 25)

View file

@ -47,6 +47,7 @@ class OSystem_MorphOS : public OSystem
// Draw a bitmap to screen.
// The screen will not be updated to reflect the new bitmap
virtual void copy_rect(const byte *buf, int pitch, int x, int y, int w, int h);
void move_screen(int dx, int dy, int height);
// Update the dirty areas of the screen
virtual void update_screen();

View file

@ -30,6 +30,7 @@ public:
void set_palette(const byte *colors, uint start, uint num) {}
void init_size(uint w, uint h);
void copy_rect(const byte *buf, int pitch, int x, int y, int w, int h) {}
void move_screen(int dx, int dy) {}
void update_screen() {}
bool show_mouse(bool visible) { return false; }
void set_mouse_pos(int x, int y) {}

View file

@ -135,6 +135,43 @@ void OSystem_SDL_Common::copy_rect(const byte *buf, int pitch, int x, int y, int
}
void OSystem_SDL_Common::move_screen(int dx, int dy, int height) {
if ((dx == 0) && (dy == 0))
return;
if (dx == 0) {
// vertical movement
if (dy > 0) {
// move down
// copy from bottom to top
for (int y = height - 1; y >= dy; y--)
copy_rect((byte *)sdl_screen->pixels + SCREEN_WIDTH * (y - dy), SCREEN_WIDTH, 0, y, SCREEN_WIDTH, 1);
} else {
// move up
// copy from top to bottom
for (int y = 0; y < height + dx; y++)
copy_rect((byte *)sdl_screen->pixels + SCREEN_WIDTH * (y - dy), SCREEN_WIDTH, 0, y, SCREEN_WIDTH, 1);
}
} else if (dy == 0) {
// horizontal movement
if (dx > 0) {
// move right
// copy from right to left
for (int x = SCREEN_WIDTH - 1; x >= dx; x--)
copy_rect((byte *)sdl_screen->pixels + x - dx, SCREEN_WIDTH, x, 0, 1, height);
} else {
// move left
// copy from left to right
for (int x = 0; x < SCREEN_WIDTH; x++)
copy_rect((byte *)sdl_screen->pixels + x - dx, SCREEN_WIDTH, x, 0, 1, height);
}
} else {
// free movement
// not neccessary for now
}
}
void OSystem_SDL_Common::add_dirty_rect(int x, int y, int w, int h) {
if (force_full)
return;

View file

@ -42,6 +42,8 @@ public:
// The screen will not be updated to reflect the new bitmap
void copy_rect(const byte *buf, int pitch, int x, int y, int w, int h);
void move_screen(int dx, int dy, int height);
// Update the dirty areas of the screen
void update_screen() = 0;

View file

@ -95,6 +95,8 @@ public:
// The screen will not be updated to reflect the new bitmap
void copy_rect(const byte *buf, int pitch, int x, int y, int w, int h);
void move_screen(int dx, int dy, int height);
// Update the dirty areas of the screen
void update_screen();
@ -1215,6 +1217,46 @@ void OSystem_WINCE3::copy_rect(const byte *buf, int pitch, int x, int y, int w,
} while (--h);
}
void OSystem_WINCE3::move_screen(int dx, int dy, int height) {
if ((dx == 0) && (dy == 0))
return;
if (dx == 0) {
// vertical movement
if (dy > 0) {
// move down
// copy from bottom to top
for (int y = height - 1; y >= dy; y--)
copy_rect(_gfx_buf + SCREEN_WIDTH * (y - dy), SCREEN_WIDTH, 0, y, SCREEN_WIDTH, 1);
} else {
// move up
// copy from top to bottom
for (int y = 0; y < height + dx; y++)
copy_rect(_gfx_buf + SCREEN_WIDTH * (y - dy), SCREEN_WIDTH, 0, y, SCREEN_WIDTH, 1);
}
} else if (dy == 0) {
// horizontal movement
if (dx > 0) {
// move right
// copy from right to left
for (int x = SCREEN_WIDTH - 1; x >= dx; x--)
copy_rect(_gfx_buf + x - dx, SCREEN_WIDTH, x, 0, 1, height);
} else {
// move left
// copy from left to right
for (int x = 0; x < SCREEN_WIDTH; x++)
copy_rect(_gfx_buf + x - dx, SCREEN_WIDTH, x, 0, 1, height);
}
} else {
// free movement
// not neccessary for now
}
}
void OSystem_WINCE3::update_screen() {
if (!hide_cursor)

View file

@ -62,6 +62,8 @@ public:
// The screen will not be updated to reflect the new bitmap
void copy_rect(const byte *buf, int pitch, int x, int y, int w, int h);
void move_screen(int dx, int dy, int height);
// Update the dirty areas of the screen
void update_screen();
@ -509,6 +511,44 @@ void OSystem_X11::copy_rect(const byte *buf, int pitch, int x, int y, int w, int
}
}
void OSystem_X11::move_screen(int dx, int dy, int height) {
if ((dx == 0) && (dy == 0))
return;
if (dx == 0) {
// vertical movement
if (dy > 0) {
// move down
// copy from bottom to top
for (int y = height - 1; y >= dy; y--)
copy_rect(local_fb + fb_width * (y - dy), fb_width, 0, y, fb_width, 1);
} else {
// move up
// copy from top to bottom
for (int y = 0; y < height + dx; y++)
copy_rect(local_fb + fb_width * (y - dy), fb_width, 0, y, fb_width, 1);
}
} else if (dy == 0) {
// horizontal movement
if (dx > 0) {
// move right
// copy from right to left
for (int x = fb_width - 1; x >= dx; x--)
copy_rect(local_fb + x - dx, fb_width, x, 0, 1, height);
} else {
// move left
// copy from left to right
for (int x = 0; x < fb_width; x++)
copy_rect(local_fb + x - dx, fb_width, x, 0, 1, height);
}
} else {
// free movement
// not neccessary for now
}
}
void OSystem_X11::update_screen_helper(const dirty_square * d, dirty_square * dout)
{
int x, y;

View file

@ -92,6 +92,10 @@ public:
// The screen will not be updated to reflect the new bitmap
virtual void copy_rect(const byte *buf, int pitch, int x, int y, int w, int h) = 0;
// Moves the screen content around by the given amount of pixels
// but only the top height pixel rows, the rest stays untouched
virtual void move_screen(int dx, int dy, int height) = 0;
// Update the dirty areas of the screen
virtual void update_screen() = 0;

View file

@ -681,16 +681,16 @@ void Scumm::fadeIn(int effect)
unkScreenEffect6();
break;
case 130:
unkScreenEffect1();
scrollEffect(3); // right unkScreenEffect1();
break;
case 131:
unkScreenEffect2();
scrollEffect(2); // left unkScreenEffect2();
break;
case 132:
unkScreenEffect3();
scrollEffect(1); // down unkScreenEffect3();
break;
case 133:
unkScreenEffect4();
scrollEffect(0); // up unkScreenEffect4();
break;
case 134:
dissolveEffect(1, 1);
@ -2092,6 +2092,88 @@ void Scumm::dissolveEffect(int width, int height) {
}
}
void Scumm::scrollEffect(int dir) {
VirtScreen *vs = &virtscr[0];
int x, y;
int step;
if ((dir == 0) || (dir == 1))
step = vs->height;
else
step = vs->width;
#define scrolltime 500 // ms the scroll is supposed to take
#define picturedelay 20
step /= (scrolltime/picturedelay);
switch (dir) {
case 0:
//up
y = 1 + step;
while (y < vs->height) {
_system->move_screen(0, -step, vs->height);
_system->copy_rect(vs->screenPtr + vs->xstart + (y - step) * vs->width,
vs->width,
0, vs->height - step,
vs->width, step);
_system->update_screen();
waitForTimer(picturedelay);
y += step;
}
break;
case 1:
// down
y = 1 + step;
while (y < vs->height) {
_system->move_screen(0, step, vs->height);
_system->copy_rect(vs->screenPtr + vs->xstart + vs->width * (vs->height-y),
vs->width,
0, 0,
vs->width, step);
_system->update_screen();
waitForTimer(picturedelay);
y += step;
}
break;
case 2:
// left
x = 1 + step;
while (x < vs->width) {
_system->move_screen(-step, 0, vs->height);
_system->copy_rect(vs->screenPtr + vs->xstart + x - step,
vs->width,
vs->width - step, 0,
step, vs->height);
_system->update_screen();
waitForTimer(picturedelay);
x += step;
}
break;
case 3:
// right
x = 1 + step;
while (x < vs->width) {
_system->move_screen(step, 0, vs->height);
_system->copy_rect(vs->screenPtr + vs->xstart + vs->width - x,
vs->width,
0, 0,
step, vs->height);
_system->update_screen();
waitForTimer(picturedelay);
x += step;
}
break;
}
}
void Scumm::unkScreenEffect6() {
if (_gameId == GID_LOOM256)
dissolveEffect(1, 1);